Templates of web generator.
- Webpack
- Webpack handles all files.
$ yo web:gulp
tree -I node_modules
.
├── CHANGELOG.md
├── LICENSE
├── README.md
├── package.json
├── src
│ ├── _index.html
│ └── entry
│ ├── img
│ ├── index.js
│ ├── modules
│ └── sass
│ └── index.scss
└── webpack
├── webpack.build.js
├── webpack.dev.js
├── webpack.entry.json
└── webpack.node.js
- dev:
$ npm run dev
- build:
$ npm run build
- dist:
$ npm run dist
html
css
js
scss
vue
coffee
-yo web
-
-
Exec
$ yo web
and the default project name is your directory name; -
Exec
$ yo web
again in the initialized directory can restorewebpack
orsrc
directory orpackage.json
file; -
Now, you can choose
Link to the shared node_modules
orInstall node_modules
in generating stage; -
shared node_modules
means that all project will share a same node_modules, and they both link togenerator-web/generators/app/templates/node_modules
;
-npm run dev
-
-
Create webpack entry dynamically, depend on the js file in
entry
directory; -
If the net port is EADDRINUSE, when you exec
$ npm run dev
there is a prompt to help you to kill it; -
According the content in
package.json
, replaceprocess.env.NAME
orprocess.env.VERSION
to correct value, injs
file;
-npm run build
-
-
Use
process.env.NODE_ENV === 'production'
to condition your code effect in development or production; -
According the content in
package.json
, replace<%= process.env.NAME %>
or<%= process.env.VERSION %>
to correct value, inhtml
file; -
According the content in
package.json
, replaceprocess.env.NAME
orprocess.env.VERSION
to correct value, injs
file; -
Inject the file source which is require with
inline
attribute in HTML;
-npm run build js
-
-
Exec
$ npm run build js
to pack a single js file which is a subfile ofentry
directory; -
Put these comments in the top of the js file, then you use
$ npm run build js
, that it will follow those rule to pack;
/**
* @webpack
* @library example
* @libraryTarget umd
*/
MIT