2016-07-07 23:23:18 +02:00
|
|
|
var path = require("path");
|
|
|
|
var webpack = require("webpack");
|
|
|
|
|
2016-07-25 01:04:09 +02:00
|
|
|
var ExtractTextPlugin = require("extract-text-webpack-plugin");
|
2016-07-25 23:22:44 +02:00
|
|
|
var postcssReporter = require("postcss-reporter");
|
|
|
|
var doiuse = require("doiuse");
|
|
|
|
var stylelint = require("stylelint");
|
2016-07-25 01:04:09 +02:00
|
|
|
var precss = require("precss");
|
|
|
|
var autoprefixer = require("autoprefixer");
|
2016-07-25 23:22:44 +02:00
|
|
|
var browsers = ["ie >= 9", "> 1%", "last 3 versions", "not op_mini all"];
|
2016-07-25 01:04:09 +02:00
|
|
|
|
2016-07-07 23:23:18 +02:00
|
|
|
module.exports = {
|
|
|
|
entry: {
|
|
|
|
"index": "./index.js",
|
|
|
|
"fix.ie9": "./fix.ie9.js"
|
|
|
|
},
|
|
|
|
|
|
|
|
output: {
|
2016-07-26 21:01:27 +02:00
|
|
|
path: path.join(__dirname, "app/dist/"),
|
2016-07-07 23:23:18 +02:00
|
|
|
filename: "[name].js",
|
2016-07-26 21:01:27 +02:00
|
|
|
publicPath: "./"
|
2016-07-07 23:23:18 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
module: {
|
2016-07-25 23:22:44 +02:00
|
|
|
preLoaders: [
|
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
loader: "eslint-loader?{failOnError: true}",
|
|
|
|
exclude: /node_modules/
|
|
|
|
}
|
|
|
|
],
|
2016-07-07 23:23:18 +02:00
|
|
|
loaders: [
|
2016-07-25 01:04:09 +02:00
|
|
|
// Handle JS/JSX files
|
2016-07-07 23:23:18 +02:00
|
|
|
{
|
|
|
|
test: /\.jsx?$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
loaders: ["babel"],
|
|
|
|
include: __dirname
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-07-25 23:22:44 +02:00
|
|
|
// Do not postcss vendor modules
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2016-07-25 23:22:44 +02:00
|
|
|
exclude: /node_modules/,
|
2016-07-25 01:04:09 +02:00
|
|
|
loader: ExtractTextPlugin.extract("style-loader", "css-loader!postcss-loader")
|
|
|
|
},
|
2016-07-25 23:22:44 +02:00
|
|
|
{
|
|
|
|
test: /\.css$/,
|
|
|
|
exclude: /app/,
|
|
|
|
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
|
|
|
|
},
|
2016-07-25 01:04:09 +02:00
|
|
|
{
|
|
|
|
test: /\.less$/,
|
|
|
|
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.scss$/,
|
|
|
|
loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
|
|
|
|
loader: "file?name=fonts/[name].[ext]"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.(woff|woff2)$/,
|
|
|
|
loader:"url?name=fonts/[name].[ext]&limit=5000"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
|
|
|
|
loader: "url?name=fonts/[name].[ext]&limit=10000&mimetype=application/octet-stream"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
|
|
|
|
loader: "url?name=img/[name].[ext]&limit=10000&mimetype=image/svg+xml"
|
2016-07-07 23:23:18 +02:00
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
2016-07-25 01:04:09 +02:00
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
$: "jquery",
|
|
|
|
jQuery: "jquery"
|
|
|
|
}),
|
|
|
|
new ExtractTextPlugin("style.css", { allChunks: true })
|
2016-07-07 23:23:18 +02:00
|
|
|
],
|
|
|
|
|
2016-07-25 01:04:09 +02:00
|
|
|
postcss: function () {
|
2016-07-25 23:22:44 +02:00
|
|
|
return [doiuse({ browsers: browsers }), stylelint, precss, autoprefixer({ browsers: browsers }), postcssReporter({ throwError: true, clearMessages: true })];
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
|
|
|
|
2016-07-07 23:23:18 +02:00
|
|
|
resolve: {
|
|
|
|
// Include empty string "" to resolve files by their explicit extension
|
|
|
|
// (e.g. require("./somefile.ext")).
|
|
|
|
// Include ".js", ".jsx" to resolve files by these implicit extensions
|
|
|
|
// (e.g. require("underscore")).
|
|
|
|
extensions: ["", ".js", ".jsx"],
|
|
|
|
|
|
|
|
// Hack for isotope
|
|
|
|
alias: {
|
|
|
|
"masonry": "masonry-layout",
|
|
|
|
"isotope": "isotope-layout"
|
2016-07-25 01:04:09 +02:00
|
|
|
},
|
2016-07-07 23:23:18 +02:00
|
|
|
}
|
|
|
|
};
|