From 586d71a419447675bd6f79d9dd2ba3d84f2be22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thierry=20Fran=C3=A7ois?= Date: Thu, 1 Feb 2018 09:39:53 +0200 Subject: [PATCH] Webpack script to pusblish fron-end files --- package.json | 37 +++++++++++++++++++++++++++++++ webpack.config.js | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 package.json create mode 100644 webpack.config.js diff --git a/package.json b/package.json new file mode 100644 index 0000000..e787f9d --- /dev/null +++ b/package.json @@ -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" + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..3ac4be2 --- /dev/null +++ b/webpack.config.js @@ -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; \ No newline at end of file