npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

create-lightweight-webapp

v1.2.3

Published

create web app

Readme

🐔 createWebApp

createWebApp generator that scaffolds out a front-end web app using gulp for the build process

🐔 Environment

node 8.10 npm 5.6.0

🐔 Installation

npm i create-lightweight-webapp --save-dev

🐔 Usage

Then, add it to your gulpfile.js:

require('create-lightweight-webapp')();

If you don't have a gulpfile.js and your os is mac

echo "require('create-lightweight-webapp')();" > gulpfile.js

then, in your terminal enter

gulp create:f2eApp

you can, in your package.json write

{
  "scripts": {
    "build:prod": "gulp clean:all && gulp build:prod",
    "build:dev": "gulp clean:all && gulp build:dev",
    "start": "gulp clean:all && gulp build:dev && gulp start:dev"
  }
}

now, you can in terminal enter

  • Run npm run start start http server and enable hot Reload service.
  • Run npm run build:dev
  • Run npm run build:prod

🐔 All Script

clear

  • gulp clean:css
  • gulp clean:js
  • gulp clean:js-vendor
  • gulp clean:img
  • gulp clean:html
  • gulp clean:all

js

  • gulp build:js-dev compile js 、 jsx output js
  • gulp build:js-prod compile js 、 jsx output minify and Uglify js
  • gulp watch:js

vendor js

  • gulp build:js-vendor compile common js library into vendor.js

css

  • gulp build:scss-dev compile SCSS into CSS
  • gulp build:scss-prod compile SCSS into minify CSS
  • gulp watch:scss

vendor css

  • build:css-vendor' compile common css

html

  • gulp build:html
  • watch:html

image jpg、png、gif

  • build-img:dev
  • build-img:prod

hot reload

  • gulp connect start http server
  • gulp watch watch html、js、scss、react

other

  • gulp start:dev
  • gulp build:dev
  • gulp build:prod
  • gulp stop

🐔 createWebApp Architecture

  - config
    -- layout.js
    -- options.js
    -- PATH.json
  - dest
    - prod
      .
      .
      .
    - dev
      .
      .
      .
    - scripts                    //gulp task
      -- cleanTask.js
      -- commandTask.js
      -- commonJoinPoint.js
      -- createAppTask.js
      -- cssTask.js
      -- hotReloadTask.js
      -- htmTask.js
      -- imageTask.js
      -- jsTask.js
      -- vendorJsTask.js
  - src                         // base architecture
    -- entry
      guideline.js              // example, web page main js file.
      home.js                   // example, web page main js file.
    -- font
    -- img
      react.png                 // example.
    -- js
      util.js                   // common js example.
    -- manual3rdCss             // manual 3rd css , css library can placed here.
      helloWord.css             // script test file.
    -- scss                     // web page main css file.
      --- common                //
        guideline.css           // example, common scss.
      guideline.scss            // example, web page main scss.
      home.scss                 // example, web page main scss.
    -- views
      --- layout
        layoutBase.ejs          // page template.
      --- react                 
        --- components          // react component.
          Button.jsx            // example, react component.
        GuidelineContainer.jsx  // example, react container
      --- shared                // partial view
      guideline.ejs             // example, web page main content.
      home.ejs                  // example, web page main content.
  .babelrc                      // babel compile options
  .gitignore
  index.js
  LICENSE
  package-lock.json
  package.json
  README.md

🐔 use vendor js

edit /config/options.js
//multiple vendor build
vendorOptions: [
    {
      distName: "vendor.js",
      vendors: [], //'react', 'react-dom', 'axios'
      destPath: {
        dev: PATH.DEST.DEV.JS_VENDOR,
        prod: PATH.DEST.PROD.JS_VENDOR,
      },
      uglifyOptions: uglifyOptions
    },
    {
      distName: "vendor2.js",
      vendors: [],
      destPath: {
        dev: PATH.DEST.DEV.JS_VENDOR,
        prod: PATH.DEST.PROD.JS_VENDOR,
      },
      uglifyOptions: uglifyOptions
    }
  ],

note: Remember install your vendor library

ex:

npm i react --save
npm i react-dom --save
npm i axios --save

🐔 use vendor css

two source

  1. from npm node_modules
  2. from ./src/manual3rdCss

for mode one

  • you can edit vendors of ./config/options.js.

ex:

vendorCssOptions: {
    distName: vendorCssName, //your create vendor name
    vendors:[], //your node_modules 3rd css name. 
    manualVendors: [`${PATH.SRC.MANUAL_CSS}/**/*.css`, `${PATH.SRC.MANUAL_CSS}/**/*.min.css`], //your manaul 3rd css path.
    destPath: PATH.DEST.CSS,
    cleanCssOptions: {
      compatibility: 'ie7',
      //keepBreaks: true,
      keepSpecialComments: '*'
    },
    autoprefixerOption: {
      browsers: ["last 4 versions", "ie >= 7"],
      cascade: false
    }
  },

for mode two

  • your can add 3rd css file to ./src/manual3rdCss

finally you can run gulp build:css-vendor build vendor.css

gulp build:css-vendor

🐔 use layout

layout config in config/layout.js.

layout.js example

module.exports = {
  guideline: {
    layout: 'layoutBase',
    meta: 'metaBase',
    header: 'headerBase',
    footer: 'footerBase',
    page: 'guideline',
    title: "風格指南",
    vendor: []          //your page vendor js name
  },
  home: {
    layout: 'layoutBase',
    meta: 'metaBase',
    header: 'headerBase',
    footer: 'footerBase',
    page: 'home',
    title: "首頁",
    vendor: []         //your page vendor js name
  },
  //format
  [your page name.] : {
    layout: [`your layout file name.`],   //layout.ejs file need create in src/views/layout
    meta: [`your meta file name.`],       //meta.ejs file need create in src/views/shared
    header: [`your header file name.`],   //header.ejs file need create in src/views/shared
    footer: [`your footer file name.`],   //footer.ejs file need create in src/views/shared
    page: [`your page main container file name.`],  //page.ejs file need create in src/views
    title: [`your page title name`]
  }
}

how add page

  1. add page to layout.js
module.exports = {
  guideline: {
    layout: 'layoutBase',
    meta: 'metaBase',
    header: 'headerBase',
    footer: 'footerBase',
    page: 'guideline',
    title: "風格指南",
    vendor: ["verdor"]
  },
  home: {
    layout: 'layoutBase',
    meta: 'metaBase',
    header: 'headerBase',
    footer: 'footerBase',
    page: 'home',
    title: "首頁",
    vendor: ["verdor", "verdor2"]
  },
  test: {
    layout: 'layoutBase',
    meta: 'metaBase',
    header: 'headerBase',
    footer: 'footerBase',
    page: 'test',
    title: "test",
    vendor: []
  } 
}
  1. create test.ejs file in src/views folder.
<p class="helloWord">hello word! im test</p>
-src
  -- views
    test.ejs
  1. create test.js file in src/entry
console.log("hello word! im test page.");
  1. create test.css file in src/scss
@import "./common/guideline";
.helloWord{
  color: red;
  font-size: 26px;
}
  1. run build script
npm run build:dev or gulp build:dev

note: you can run npm run start test your page.

open your browser at url enter http://0.0.0.0:9527/html/test.html

🐔 use proxy

open config/option.js

add

  "/api/**": {
    target: "http://0.0.0.0:9528",
    changeOrigin: true,
    pathRewrite: {
      '^/api/': ''
    }
  },
  "/*.html": {
    target: "http://0.0.0.0:9527/html",
    changeOrigin: true
  },