Updated webpack SCSS extract to provide sourcemaps

This commit is contained in:
Dan Brown 2018-03-18 14:47:43 +00:00
parent 8b27ce3296
commit 2c8d7da885
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 50 additions and 34 deletions

23
package-lock.json generated
View File

@ -3654,6 +3654,29 @@
"loader-utils": "1.1.0"
}
},
"extract-text-webpack-plugin": {
"version": "4.0.0-beta.0",
"resolved": "https://registry.npmjs.org/extract-text-webpack-plugin/-/extract-text-webpack-plugin-4.0.0-beta.0.tgz",
"integrity": "sha512-Hypkn9jUTnFr0DpekNam53X47tXn3ucY08BQumv7kdGgeVUBLq3DJHJTi6HNxv4jl9W+Skxjz9+RnK0sJyqqjA==",
"dev": true,
"requires": {
"async": "2.6.0",
"loader-utils": "1.1.0",
"schema-utils": "0.4.5",
"webpack-sources": "1.1.0"
},
"dependencies": {
"async": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz",
"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==",
"dev": true,
"requires": {
"lodash": "4.17.4"
}
}
}
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",

View File

@ -11,12 +11,11 @@
"devDependencies": {
"@babel/core": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"autoprefixer": "^8.1.0",
"babel-loader": "^8.0.0-beta.0",
"babel-polyfill": "^6.26.0",
"autoprefixer": "^8.1.0",
"css-loader": "^0.28.10",
"extract-loader": "^1.0.2",
"file-loader": "^1.1.11",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"livereload": "^0.7.0",
"node-sass": "^4.7.2",
"npm-run-all": "^4.1.2",

View File

@ -2,6 +2,7 @@ const path = require('path');
const dev = process.env.NODE_ENV !== 'production';
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const config = {
target: 'web',
@ -30,19 +31,9 @@ const config = {
},
{
test: /\.scss$/,
use: ExtractTextPlugin.extract({
fallback: "style-loader",
use: [{
loader: 'file-loader',
options: {
name: '[name].css',
context: './src/css/',
outputPath: './',
publicPath: 'public/'
}
}, {
loader: 'extract-loader', options: {
publicPath: '',
}
}, {
loader: "css-loader", options: {
sourceMap: dev
}
@ -60,10 +51,13 @@ const config = {
sourceMap: dev
}
}]
})
}
]
},
plugins: []
plugins: [
new ExtractTextPlugin("[name].css"),
]
};
if (dev) {