lucify-webpack-config
v0.1.5
Published
Webpack base configuration for Lucify projects
Downloads
3
Readme
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 = require('lucify-webpack-config');
var opts = {
entry: path.resolve('./src/entry-point.jsx'),
pageDefs: [{
title: 'My example page title',
description: 'Description'
}]
}
const config = lucifyWebpackConfig.template(opts);
// at this point, you can naturally edit any options
// options in the returned webpack configuration
config.output.dist = 'build' // default would be 'dist'
module.exports = config;
Add the following to your package.json:
"scripts": {
"build": "webpack",
"start": "webpack-dev-server --config=webpack.config.dev.js --inline --hot --port 3000 --host 0.0.0.0",
}
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.