Created
February 20, 2017 03:00
-
-
Save matthewjumpsoffbuildings/54aa7875c8ee2b35364550a857a79dbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack') | |
const path = require('path') | |
const ExtractTextPlugin = require('extract-text-webpack-plugin') | |
const extractSass = new ExtractTextPlugin({ | |
filename: "./css/bundle.css" | |
}) | |
const extractPug = new ExtractTextPlugin({ | |
filename: "./templates/[path][name].html" | |
}) | |
module.exports = { | |
context: path.join(__dirname, '..'), | |
entry: ['./js/app.js', './scss/app.scss'], | |
output: { | |
path: path.join(__dirname, '..'), | |
filename: './js/build/bundle.js' | |
}, | |
//watch: false, | |
//stats: "minimal", | |
devtool: "source-map", | |
plugins: [ | |
extractSass, | |
extractPug | |
], | |
module: { | |
rules: [ | |
// js loading with babel es2015 support | |
{ | |
test: /\.js$/, | |
exclude: /(node_modules|bower_components)/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['es2015'], | |
sourceMap: true | |
} | |
} | |
}, | |
// sass loading with autoprefix and saving to css | |
{ | |
test: /\.s(c|a)ss$/, | |
use: extractSass.extract({ | |
use: [ | |
{ | |
loader: "css-loader", | |
options: { | |
sourceMap: true, | |
url: false //dont try and pull imgs etc into webpack via scss url( | |
} | |
}, | |
{ | |
loader: 'postcss-loader', | |
options: { | |
sourceMap: true, | |
plugins: function () { | |
return [ | |
require('autoprefixer') | |
] | |
} | |
} | |
}, | |
{ | |
loader: "sass-loader", | |
options: { | |
sourceMap: true | |
} | |
} | |
] | |
}) | |
}, | |
// pug loading | |
{ | |
test: /\.pug$/, | |
use: extractPug.extract({ | |
use: [ | |
"html-loader", | |
"pug-html-loader?pretty&exports=false" | |
] | |
}) | |
} | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment