generator-webpack-app
Yeoman generator
Note
- rename gitignore to .gitignore when generates template from this generator
Getting Started
What is Yeoman?
Trick question. It's not a thing. It's this guy:
Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.
Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.
npm install -g yo
Yeoman Generators
Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.
To install generator-webpack-app from npm, run:
npm install -g generator-webpack-app
Finally, initiate the generator:
yo webpack-app
Why YEOMAN
Yeoman was released at Google I/O 2012.
Session: Better Web App Development Through Tooling.
Focus on development not debugging.
Disparate tools without smooth integration.
- Go from your idea to a rough prototype in ten minutes
- Reduce friction from the things that you should be doing, such as testing
- DRY applies to using tools, too!
So Yeoman was introduced.
What is YEOMAN
Yeoman is an open source project which consists of tools and frameworks intended to help developers quickly build high quality web applications. To do so, Yeoman provide a generator ecosystem.
The Yeoman workflow comprises three types of tools:
- scaffolding tool (yo)
- build tool (Grunt, Gulp, Webpack)
- package manager (Bower, npm)
One-line Install
npm install -g yo
How to create a generator
-
npm install -g generator-generator
(Yeoman generator to generate a Yeoman generator) yo generator
- Put your web app template into app/templates
- Edit index.js
- If you want to publish your generator to npm server
- no npm account:
npm adduser
- has npm account:
npm login
- no npm account:
-
npm publish
Remider: Everytime you make change to generator and want to publish to npm server again, make sure you change your version in the package.json
Create template from generator
npm install –g generatorName
- Delete .yo-rc.json in the parent directory
or all the folders of created template will not in the current directory -
yo
then choose generator