cookiecutter-webpack v0.3.2
Cookiecutter-webpack
Boilerplate for setting up webpack 2 configuration with hot reloading, babel for es6 modules, react + redux for views and state, and karma + mocha + expect for testing.
Getting Started
Download cookiecutter to a global python path
$ pip install cookiecutterIn your project directory run
$ cookiecutter git@github.com:hzdg/cookiecutter-webpack.gitAnswer the prompts then cd into your newly created project directory.
Install npm packages
$ npm installStart the server
$ npm startOpen up http://localhost:8080 in your browser.
You will have a React / Redux counter app running with redux dev-tools. See the generated README.md for an explanation of the react / redux project structure.
You can run the test suite
$ npm testYou should also create a new git repo and push it to github
$ git init
$ git add .
$ git commit -m "Init"
$ git remote add origin git@github.com:hzdg/project_name.git
$ git push -u origin masterOptions
project_name: Your Project Namerepo_name: Name of this projects git repositoryrepo_owner: Your github usernamestatic_root: Path to where this projects source code lives, or path to static files directory if integrating into an existing projectproduction_output_path: Path where your compiled bundles should goauthor_name: Your Namedescription: A short description of the project for theREADME.mdfileversion: Project version numberexisting_project:nif this is a new project andyif you're integrating into an existing project. See the notes below about integrating into an existing project.css_extension:none,less,sass- uselessorsassto preprocess styles.use_ejs:yif you want to includeejstemplates and loaders in the project. Recommended if not using an existing project.
Integrating into existing projects
You can chain this into an existing cookiecutter project by installing via the projects ./hooks/post_gen_project.py file or just installing it via the command line.
Using post hooks
Here is a django project post hook example that chains this through a django cookiecutter project.
from cookiecutter.main import cookiecutter
cookiecutter(
'git@github.com:hzdg/cookiecutter-webpack.git',
replay=False, overwrite_if_exists=True, output_dir='../',
checkout=None, no_input=True, extra_context={
'project_name': '{{ cookiecutter.project_name }}',
'repo_name': '{{ cookiecutter.repo_name }}',
'repo_owner': 'hzdg',
'static_root': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}',
'production_output_path': '{{ cookiecutter.project_dir }}/static/{{ cookiecutter.project_dir }}/dist/',
'author_name': '{{ cookiecutter.author_name }}',
'description': '{{ cookiecutter.description }}',
'version': '{{ cookiecutter.version }}',
'existing_project': 'y',
'css_extension': 'sass',
'use_ejs': 'n'
})The flag existing_project will move/remove some files and dependencies and also add supporting configurations for a django project.
Using command line
Just make sure you use the --overwrite-if-exists or -f flag so cookiecutter can work within your existing project structure. You will also probably want to point to your existing projects parent directory and make sure you use the same repo_name as the project directory so your package.json files are installed at the project root.
cookiecutter -f -output-dir ../ git@github.com:hzdg/cookiecutter-webpack.gitContributing
Accepting pull requests!
Clone the project:
$ git clone git@github.com:hzdg/cookiecutter-webpack.gitInstall python and npm dependencies:
$ pip install -r requirements.txt && npm installRun build tests:
$ npm test