forked from jdan/tota11y
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.babel.js
63 lines (58 loc) · 1.78 KB
/
webpack.config.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
let fs = require("fs");
let handlebars = require("handlebars");
let path = require("path");
let postcss = require("postcss");
let webpack = require("webpack");
let options = require("./utils/options");
// PostCSS plugin to append !important to every CSS rule
let veryimportant = postcss.plugin("veryimportant", function() {
return function(css) {
css.eachDecl(function(decl) {
decl.important = true;
});
};
});
let bannerTemplate = handlebars.compile(
fs.readFileSync("./templates/banner.handlebars", "utf-8"));
module.exports = {
entry: {
app: "./index.js",
},
output: {
path: path.join(__dirname, "build"),
filename: "tota11y.min.js",
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel",
query: {
jsxPragma: options.jsxPragma,
},
},
{ test: /\.handlebars$/, loader: "handlebars", },
{
test: /\.less$/,
loader: "style!css!postcss!autoprefixer?{browsers:['> 1%']}!less",
},
],
},
plugins: [
// Add a banner to our bundles with a version number, date, and
// license info
new webpack.BannerPlugin(
bannerTemplate({
version: require("./package.json").version,
date: new Date().toISOString().slice(0, 10),
}),
{entryOnly: true}),
// Make the JSX pragma function available everywhere without the need
// to use "require"
new webpack.ProvidePlugin({
[options.jsxPragma]: path.join(__dirname, "utils", "element"),
}),
],
postcss: [veryimportant],
};