Skip to content

Instantly share code, notes, and snippets.

@squalvj
Created September 15, 2018 14:41
Show Gist options
  • Save squalvj/29c85cd18bb2060614b2a8ae855b9e3b to your computer and use it in GitHub Desktop.
Save squalvj/29c85cd18bb2060614b2a8ae855b9e3b to your computer and use it in GitHub Desktop.
Webpack + Sass + Pug
const path = require('path');
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const pug = {
test: /\.pug$/,
use: [
'html-loader?attrs=false',
'pug-html-loader'
]
}
const sass = {
test: /\.sass$/,
use: [
"style-loader", // creates style nodes from JS strings
"css-loader", // translates CSS into CommonJS
"sass-loader" // compiles Sass to CSS, using Node Sass by default
]
}
const config = {
entry: './src/app.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js'
},
module: {
rules: [
pug,
sass
]
},
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.pug',
inject: false,
})
]
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment