Webpack configuration template
This is an internal Lucify tool that provides a webpack configuration template for Lucify projects.
Install
npm install lucify-webpack-config webpack webpack-dev-server
Usage
Create webpack.config.js
in your project root:
var lucifyWebpackConfig = ; var opts = entry: path pageDefs: title: 'My example page title' description: 'Description' const config = lucifyWebpackConfig; // at this point, you can naturally edit any options// options in the returned webpack configurationconfigoutputdist = 'build' // default would be 'dist' moduleexports = config;
Add the following to your package.json:
"scripts":
You can then build a distribution in the build
folder with:
npm run-script build
Or run a development server:
npm start
Note that there is no need to install any other dependencies, such as webpack loaders.
Options
entry
: Entry point for javascript bundle. Required.optimize
: Set totrue
to enable optimization of assets. Defaults to false.externalStyles
: Set totrue
to useExtractTextPlugin
to bundle styles in their own file. Defauls tofalse
.pageDefs
: Array of objects defining html pages to create. Each object corresponds to a single page, with all its fields being passed to the page template. For each object, the following special fields are available:path
: Path of the page, relative tooutput.publicPath
, defaults to''
pageTemplate
: Handlebars page template for the page. Defaults tosrc/page-template.hbs
.filename
Filename for the page, without path. Defaults toindex.html
.
Test
Make sure you have the correct node version
nvm use
Then run tests with
npm test
License
This project is released under the MIT license.