npm install hugo-webpack-boilerplate
// Exports.moduleexports = ;
Alternatively, if you are not using Hugo’s default
// Exports.moduleexports =;
Currently, only the Hugo
outDir are customizable. Over time, this module will be extended to allow further customizations.
static/ (Hugo’s default), so for example, the image should be located at
static/img/example.jpg. Note the usage of
~ (tilde), which will make sure Webpack can find the assets. Also, this module relies on interpolation by the
html-loader, so make sure to import assets using
require, as shown below.
webpack -p, Webpack will take all these assets,
optimize-minimize them, and put them in the
dist/ folder. Alternatively, you can run
webpack -w to start the local development server.
This is an example
This is an example
- I’m getting UnCSS errors, like
Could not load script: "file:///~js/script.js"?
UnCSS attempts to load scripts from disk, which will not work if they are referenced by
~. The error is however non-blocking, and the UnCSS output is still useful. Just note that any selectors dynamically added will not be in the resulting stylesheet.
- The watching task causes Webpack to continuously reload?
There is a bug in watchpack causing the watcher to reload the same files over and over until the files settle. Apart from being an inconvenience, it does not affect your bundles.
- Can I use configure or add custom Webpack loaders or plugins?
Right now, no, there is no way to do this. Feel free to submit an issue or PR if you’d like to see any additions. It should be pretty simple to add this to the
fromConfig function in
See the CHANGELOG for a list of changes.
The MIT License (MIT) Copyright (c) 2017 Mark van Seventer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.