Created
September 15, 2018 14:41
-
-
Save squalvj/29c85cd18bb2060614b2a8ae855b9e3b to your computer and use it in GitHub Desktop.
Webpack + Sass + Pug
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 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