feat: make extractCSS configurable

This commit is contained in:
Clark Du 2017-11-11 20:52:45 +08:00
parent a7a5aea003
commit ff4a5bd404
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9
2 changed files with 8 additions and 5 deletions

View File

@ -105,10 +105,13 @@ export default function webpackBaseConfig(name) {
} }
// CSS extraction // CSS extraction
if (this.options.build.extractCSS) { const extractCSS = this.options.build.extractCSS
config.plugins.push(new ExtractTextPlugin({ if (extractCSS) {
filename: this.options.build.filenames.css const extractOptions = Object.assign(
})) { filename: this.options.build.filenames.css },
typeof extractCSS === 'object' ? extractCSS : {}
)
config.plugins.push(new ExtractTextPlugin(extractOptions))
} }
// Workaround for hiding Warnings about plugins without a default export (#1179) // Workaround for hiding Warnings about plugins without a default export (#1179)

View File

@ -2,7 +2,7 @@ export default function vueLoader() {
// https://vue-loader.vuejs.org/en // https://vue-loader.vuejs.org/en
const config = { const config = {
postcss: this.options.build.postcss, postcss: this.options.build.postcss,
extractCSS: this.options.build.extractCSS, extractCSS: !!this.options.build.extractCSS,
cssSourceMap: this.options.build.cssSourceMap, cssSourceMap: this.options.build.cssSourceMap,
preserveWhitespace: false, preserveWhitespace: false,
loaders: { loaders: {