Created
October 17, 2018 15:41
-
-
Save mitnick78/53aec4b32b70bee95e33cbfbc1d01087 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| const entryPlus = require('webpack-entry-plus'); | |
| const glob = require('glob'); | |
| const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
| const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development'; | |
| const extractSass = new ExtractTextPlugin({ | |
| filename: '[name].css', | |
| disable: process.env.NODE_ENV === 'development' | |
| }); | |
| const entryFiles = [ | |
| { | |
| entryFiles: glob.sync('./build/resources/src/**/*.scss'), | |
| outputName(item) { | |
| return item.replace('./build/resources/', '../'); | |
| }, | |
| }, | |
| ]; | |
| console.log(entryPlus(entryFiles)) | |
| module.exports = { | |
| mode, | |
| watch: false, | |
| entry: entryPlus(entryFiles), | |
| output: { | |
| filename: '[name].css', | |
| path: path.resolve(__dirname, './application/site/resources/', "src"), | |
| }, | |
| module: { | |
| rules: [{ | |
| test: /\.(scss|css)$/, | |
| use: extractSass.extract({ | |
| use: [ | |
| { | |
| loader: 'css-loader', | |
| options: { | |
| sourceMap: true, | |
| minimize: true | |
| } | |
| }, | |
| { | |
| loader: 'sass-loader', | |
| options: { | |
| sourceMap: true | |
| } | |
| }, | |
| { | |
| loader: 'postcss-loader', | |
| options: { | |
| config: { | |
| path: 'postcss.config.js', | |
| }, | |
| sourceMap: true | |
| } | |
| }, | |
| { | |
| loader: 'stylefmt-loader', | |
| options: { | |
| config: ".stylelintrc" | |
| } | |
| } | |
| ], | |
| fallback: { | |
| loader: 'style-loader', | |
| options: { | |
| sourceMap: true | |
| } | |
| } | |
| }) | |
| }] | |
| }, | |
| plugins: [ | |
| extractSass | |
| ] | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment