2017-04-30 11:58:25 +00:00
|
|
|
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
|
|
|
|
2017-05-05 14:47:28 +00:00
|
|
|
export function extractStyles (ext) {
|
2017-04-30 11:58:25 +00:00
|
|
|
return !this.dev && !!this.options.build.extractCSS && this.options.build.extractCSS[ext] !== false
|
|
|
|
}
|
|
|
|
|
2017-05-05 14:47:28 +00:00
|
|
|
export function styleLoader (ext, loader = []) {
|
2017-04-30 11:58:25 +00:00
|
|
|
if (!extractStyles.call(this, ext)) {
|
|
|
|
return ['vue-style-loader', 'css-loader'].concat(loader)
|
|
|
|
}
|
|
|
|
return ExtractTextPlugin.extract({
|
|
|
|
use: ['css-loader?minimize'].concat(loader),
|
|
|
|
fallback: 'vue-style-loader'
|
|
|
|
})
|
|
|
|
}
|