jcrp
Version:
Starter Kit para Frontends con el stack de HandleBars , SCSS , Babel , ITCSS , PostCSS , Autoprefixer y Webpack.
82 lines (81 loc) • 2.49 kB
JavaScript
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const autoprefixer = require('autoprefixer');
module.exports = {
entry: './src/app.js',
output: {
path: path.resolve(__dirname, '../dist'),
filename: 'js/bundle.js'
},
devtool: 'source-map',
devServer: {
port: 4000,
open: true
},
module: {
rules: [{
test: /\.hbs$/,
loader: 'handlebars-loader'
},
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
autoprefixer: {
browser: ["last 2 versions"]
},
plugins: () => [
autoprefixer
]
}
},
'sass-loader',
],
},
{
test: /\.(jpe?g|png|gif|svg)$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'media/',
useRelativePath: true
}
},
{
loader: 'image-webpack-loader',
options: {
bypassOnDebug: true,
disable: true,
}
}
]
},
{
test: /\.(ttf|eot|woff2?|mp3|mp4|txt|pdf|xml)$/i,
use: 'file-loader?name=data/[name].[ext]'
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/handlebars/index.hbs',
minify: {
html5: true,
collapseWhitespace: true,
caseSensitive: true,
removeComments: true,
removeEmptyElements: false
}
}),
new MiniCssExtractPlugin({
filename: "css/[name].css",
chunkFilename: "[id].css"
})
]
};