A sample Django project that uses Webpack to manage, bundle, and process static assets.
- Node & NPM
- Python 2.7 or 3.6 (with Pip)
% npm install
% pip install -r requirements.txt
% npm run build
% ./manage.py runserver
# Open in your browser
% open "http://localhost:8000"
There are a number of advantages to using something to manage and bundle static assets.
- minification (smaller JS/CSS files) results in faster downloads and faster parsing of your static files
- file combining (combining multiple JS/CSS files) results in faster downloads although this is less of an advantage with HTTP2
- dependency management - rather than copying bootstrap or jquery into your source tree, there's simply an entry in
package.json
- caching - having few static asset bundles with unique hashes allows setting very long expiry headers which results in faster sites