Home

Awesome

šŸš‚ generator-choo-webpack Build Status NPM version Dependency Status

Create the minimal Choo + Babel + Webpack project boilerplate.

$ yo choo-webpack my-app
> do you want to use Twitter Bootstrap v3? (y/N)
Project generated!
$ cd my-app
$ npm start
Development server listening at <http://localhost:8080>

Features

Install

Install Yeoman (generator framework) and generator-choo-webpack globally:

$ npm install -g yo generator-choo-webpack

Generate

Generate scaffolding in a target folder:

$ yo choo-webpack <destinationFolder>

Or in the current folder:

$ yo choo-webpack .

Run

Development

Start the local development server and visit http://localhost:8080.

$ npm start

Production

Bundle the app into a dist folder ready to be deployed.

$ npm run build

.
ā””ā”€ā”€ dist
 Ā Ā  ā”œā”€ā”€ index.html
 Ā Ā  ā”œā”€ā”€ 5df766af1ced8ff1fe0a.css
 Ā Ā  ā”œā”€ā”€ 5df766af1ced8ff1fe0a.js
 Ā Ā  ā””ā”€ā”€ img
  Ā Ā     ā””ā”€ā”€ ...

To test the production build locally, spin up a static asset server to avoid broken links.

$ npm run build && npm run serve
server listening on http://localhost:8080

Anatomy of the Scaffolding

Here's the generated project folder:

.
ā”œā”€ā”€ README.md          # for your personal use, notes
ā”œā”€ā”€ package.json       # dependencies, implements the `npm` commands
ā”œā”€ā”€ src                # your choo application code goes here
ā”‚Ā Ā  ā””ā”€ā”€ index.js       # root choo component, begin hacking here
ā”œā”€ā”€ static             # holds static assets (html, css, js, img, ...)
ā”‚Ā Ā  ā”œā”€ā”€ css
ā”‚Ā Ā  ā”‚Ā Ā  ā”œā”€ā”€ index.scss # root css file that should @import other css files
ā”‚Ā Ā  ā”‚Ā Ā  ā””ā”€ā”€ bootstrap  # if you opted into bootstrap, can customize it here
ā”‚Ā Ā  ā”‚Ā Ā   Ā Ā  ā”œā”€ā”€ pre-customizations.scss # tweak bootstrap $vars before it loads
ā”‚Ā Ā  ā”‚Ā Ā   Ā Ā  ā””ā”€ā”€ customizations.scss     # override bootstrap after it loads
ā”‚Ā Ā  ā”œā”€ā”€ favicon.ico    # a default favicon for you to replace
ā”‚Ā Ā  ā”œā”€ā”€ index.html     # root html file
ā”‚Ā Ā  ā””ā”€ā”€ index.js       # root javascript file, webpack entrypoint
ā”œā”€ā”€ .bootstraprc       # if you opted into bootstrap, you can configure it here
ā”œā”€ā”€ webpack.config.js
ā””ā”€ā”€ dist               # the stand-alone folder generated by `npm run build`
    ā”œā”€ā”€ index.html     # throw the contents on a server and open index.html
    ā”œā”€ā”€ <hash>.js
    ā”œā”€ā”€ <hash>.css
    ā””ā”€ā”€ ...

License

MIT Ā© Dan Neumann