Skip to content

Instantly share code, notes, and snippets.

@auniverseaway
Last active July 14, 2017 20:02
Show Gist options
  • Save auniverseaway/3d75197e931b3c56d8cdba4f6934db56 to your computer and use it in GitHub Desktop.
Save auniverseaway/3d75197e931b3c56d8cdba4f6934db56 to your computer and use it in GitHub Desktop.
/**
* Pug Ranch Client Library Build System
*/
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const project = './jcr_root/apps/pugranch/clientlibs';
module.exports = {
entry: {
'base/publish': [
`${project}/base/publish/src/js/app.js`,
`${project}/base/publish/src/less/app.less`,
],
'base/author': [
`${project}/base/author/src/js/app.js`,
`${project}/base/author/src/less/app.less`,
],
'base/theme': [
`${project}/base/theme/src/js/app.js`,
`${project}/base/theme/src/less/app.less`,
],
},
output: {
path: `${__dirname}/jcr_root/apps/pugranch/clientlibs`,
filename: '[name]/dist/js/app.min.js',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env'],
},
},
},
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'eslint-loader',
options: {
failOnError: true,
},
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
use: [{
loader: 'css-loader',
options: {
url: false,
minimize: true,
},
}, {
loader: 'less-loader',
options: {
url: false,
},
}],
}),
},
],
},
plugins: [
new UglifyJSPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new ExtractTextPlugin({ filename: '[name]/dist/css/app.min.css', disable: false }),
],
stats: {
colors: true,
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment