2018-10-18 10:26:25 -04:00
|
|
|
const path = require('path');
|
|
|
|
const html = require('html-webpack-plugin');
|
|
|
|
const text = require('extract-text-webpack-plugin');
|
|
|
|
const copy = require('copy-webpack-plugin')
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: 'production',
|
2018-11-02 06:57:52 -04:00
|
|
|
entry: './templates/index.js',
|
2018-10-18 10:26:25 -04:00
|
|
|
output: {
|
|
|
|
filename: 'site.js',
|
2018-11-02 06:48:02 -04:00
|
|
|
path: path.resolve(__dirname, 'dist', 'public', 'assets'),
|
|
|
|
publicPath: '/assets'
|
2018-10-18 10:26:25 -04:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test:/\.(s*)css$/,
|
|
|
|
use: text.extract({
|
|
|
|
fallback: 'style-loader',
|
|
|
|
use: [
|
|
|
|
'css-loader',
|
|
|
|
'sass-loader',
|
|
|
|
{
|
|
|
|
loader: 'postcss-loader',
|
|
|
|
options: {
|
|
|
|
plugins: function () { // post css plugins, can be exported to postcss.config.js
|
|
|
|
return [
|
|
|
|
require('autoprefixer')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new html({
|
2018-11-02 06:48:02 -04:00
|
|
|
filename: '../../templates/layout.html.hbs',
|
2018-11-02 06:57:52 -04:00
|
|
|
template: 'templates/layout.html.hbs',
|
2018-10-18 10:26:25 -04:00
|
|
|
}),
|
|
|
|
new text({
|
|
|
|
filename: 'site.css'
|
|
|
|
}),
|
|
|
|
new copy([
|
|
|
|
{
|
2018-11-02 06:57:52 -04:00
|
|
|
from: 'templates/*.hbs',
|
2018-10-18 10:26:25 -04:00
|
|
|
to: path.resolve(__dirname, 'dist', "templates"),
|
|
|
|
ignore: [ 'layout.html.hbs' ],
|
|
|
|
flatten: true
|
|
|
|
}
|
|
|
|
])
|
|
|
|
]
|
|
|
|
};
|