Moved sass build out of webpack, updated npm deps

Moving sass out of webpack cleans the setup quite considerably and
brings a good speed improvement.
Made use of npm-run-all so the previous commands still run like before.
This commit is contained in:
Dan Brown 2020-06-27 16:52:26 +01:00
parent d5de28c444
commit 540119f133
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
3 changed files with 475 additions and 1373 deletions

1789
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,30 +1,31 @@
{
"private": true,
"scripts": {
"build": "webpack",
"production": "NODE_ENV=production webpack && rm -f ./public/dist/*styles.js",
"build-profile": "NODE_ENV=production webpack --profile --json > webpack-stats.json && rm -f ./public/dist/*styles.js",
"build:css:dev": "sass ./resources/sass:./public/dist",
"build:css:watch": "sass ./resources/sass:./public/dist --watch",
"build:css:production": "sass ./resources/sass:./public/dist -s compressed",
"build:js:dev": "webpack",
"build:js:watch": "webpack --watch",
"build:js:production": "NODE_ENV=production webpack",
"build": "npm-run-all --parallel build:*:dev",
"production": "npm-run-all --parallel build:*:production",
"dev": "npm-run-all --parallel watch livereload",
"watch": "webpack --watch",
"watch": "npm-run-all --parallel build:*:watch",
"livereload": "livereload ./public/dist/",
"permissions": "chown -R $USER:$USER bootstrap/cache storage public/uploads"
},
"devDependencies": {
"css-loader": "^3.4.2",
"livereload": "^0.9.1",
"mini-css-extract-plugin": "^0.9.0",
"npm-run-all": "^4.1.5",
"sass-loader": "^8.0.2",
"sass": "^1.26.9",
"style-loader": "^1.1.3",
"webpack": "^4.42.1",
"webpack-cli": "^3.3.11"
"webpack": "^4.43.0",
"webpack-cli": "^3.3.12"
},
"dependencies": {
"clipboard": "^2.0.6",
"codemirror": "^5.52.2",
"dropzone": "^5.7.0",
"markdown-it": "^10.0.0",
"codemirror": "^5.55.0",
"dropzone": "^5.7.1",
"markdown-it": "^11.0.0",
"markdown-it-task-lists": "^2.1.1",
"sortablejs": "^1.10.2",
"vue": "^2.6.11",

View file

@ -1,48 +1,16 @@
const path = require('path');
const dev = process.env.NODE_ENV !== 'production';
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const config = {
target: 'web',
mode: dev? 'development' : 'production',
entry: {
app: './resources/js/index.js',
styles: './resources/sass/styles.scss',
"export-styles": './resources/sass/export-styles.scss',
"print-styles": './resources/sass/print-styles.scss',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public/dist')
},
module: {
rules: [
{
test: /\.scss$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {}
},
{
loader: "css-loader", options: {
sourceMap: dev
}
}, {
loader: "sass-loader", options: {
sourceMap: dev
}
}
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: "[name].css",
}),
]
};
if (dev) {