Webpack script to pusblish fron-end files

This commit is contained in:
Thierry François 2018-02-01 09:39:53 +02:00
parent 9ba6465faa
commit 586d71a419
2 changed files with 93 additions and 0 deletions

37
package.json Normal file
View File

@ -0,0 +1,37 @@
{
"name": "colymba-gridfield-bulk-editing-tools",
"version": "3.0.0",
"description": "Bulk upload and record editing for SilverStripe CMS",
"engines": {
"node": "^6.x"
},
"scripts": {
"build": "NODE_ENV=production webpack -p --bail --progress",
"watch": "NODE_ENV=development webpack --watch --progress"
},
"repository": {
"type": "git",
"url": "git://github.com/tractorcow/silverstripe-fluent.git"
},
"keywords": [
"bulk",
"manager",
"upload",
"silverstripe"
],
"author": "Thierry Francois",
"license": "BSD-3-Clause",
"bugs": {
"url": "https://github.com/colymba/GridFieldBulkEditingTools/issues"
},
"homepage": "https://github.com/colymba/GridFieldBulkEditingTools",
"dependencies": {},
"devDependencies": {
"node-sass": "^4.7.2",
"sass-loader": "^6.0",
"css-loader": "^0.28",
"style-loader": "^0.19",
"extract-text-webpack-plugin": "^3.0",
"webpack": "^3.10.0"
}
}

56
webpack.config.js Normal file
View File

@ -0,0 +1,56 @@
const path = require('path');
const PATHS = {
ROOT: path.resolve(),
SRC: path.resolve('client/src'),
DIST: path.resolve('client/dist'),
};
const ENV = process.env.NODE_ENV;
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractSASS = new ExtractTextPlugin({ filename: 'styles/bulkTools.css' });
const config = [
{
name: 'js',
entry: [
`${PATHS.SRC}/js/manager.js`,
`${PATHS.SRC}/js/managerBulkEditingForm.js`,
`${PATHS.SRC}/js/uploader.js`
],
output: {
path: PATHS.DIST,
filename: 'js/bulkTools.js'
},
devtool: (ENV !== 'production') ? 'source-map' : ''
},{
name: 'scss',
entry: [
`${PATHS.SRC}/styles/manager.scss`,
`${PATHS.SRC}/styles/managerBulkEditingForm.scss`,
`${PATHS.SRC}/styles/uploader.scss`
],
output: {
path: PATHS.DIST,
filename: 'styles/bundle.css'
},
devtool: (ENV !== 'production') ? 'source-map' : '',
module: {
rules: [{
test: /\.scss$/,
use: extractSASS.extract({
fallback: 'style-loader',
use: [ 'css-loader', 'sass-loader' ]
})
}]
},
plugins: [
extractSASS
]
}
];
module.exports = config;