webpack Plugin for DocPad
DocPad plugin that allows bundling CommonJs/AMD/Labeled Modules for the browser using webpack.
Install
$ docpad install webpack
Usage
Reference the webpack documentation for a full understanding of webpack. The below is only an introduction to how to use it with DocPad:
Entry
The entry point to webpack defaults to src/entry.js
, so create a file there:
console.write("It works.");
When building with DocPad, webpack will compile the bundles to out/bundle.js
.
Second file
Create a file src/content.js
with the following content:
module.exports = "It works from content.js.";
Modify entry.js
to make use of it:
var content = require("./content.js");
console.log(content);
Rebuilding with DocPad will bundle both entry.js
and content.js
into the
same out/bundle.js
.
Configuration
The default configuration for this plugin is the equivalant of adding the following webpack options to your DocPad configuration file:
plugins:
webpack:
webpackOptions:
entry: './entry.js'
context: ''
cache: false
optimize:
minimize: false
output:
path: ''
filename: 'bundle.js'
History
You can discover the history inside the History.md
file
Contributing
You can discover the contributing instructions inside the Contributing.md
file
License
Licensed under the incredibly permissive MIT License
Copyright © 2013 Rob Loach