Awesome
š generator-choo-webpack
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
- Optional Twitter Bootstrap (Sass) v3: You can opt-in during the generator prompt. Once you opt-in, you can immediately start using Bootstrap classes and it'll just work.
- Sass support:
Just write SASS in your
.scss
files if you want it. - CSS vendor autoprefixing:
Automatically adds prefixes like
-webkit
to your styles when necessary. - Babel plugins: es2040 +
{ ...spread }
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