mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-17 04:40:03 -06:00
@@ -40,6 +40,7 @@ module.exports = {
|
||||
// CSS related options
|
||||
css: {
|
||||
// extract CSS in components into a single CSS file (only in production)
|
||||
// can also be an object of options to pass to extract-text-webpack-plugin
|
||||
extract: true,
|
||||
|
||||
// enable CSS source maps?
|
||||
|
||||
@@ -103,18 +103,15 @@ module.exports = (api, options) => {
|
||||
|
||||
// inject CSS extraction plugin
|
||||
if (extract) {
|
||||
const userOptions = options.extractCSS && typeof options.extractCSS === 'object'
|
||||
? options.extractCSS
|
||||
const extractOptions = userOptions.extract && typeof userOptions.extract === 'object'
|
||||
? userOptions.extract
|
||||
: {}
|
||||
webpackConfig
|
||||
.plugin('extract-css')
|
||||
.use(ExtractTextPlugin, [Object.assign({
|
||||
filename: `css/[name].[contenthash:8].css`,
|
||||
allChunks: true
|
||||
}, userOptions)])
|
||||
}, extractOptions)])
|
||||
}
|
||||
|
||||
// TODO document receipe for using css.loaderOptions to add `data` option
|
||||
// to sass-loader
|
||||
})
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ const schema = createSchema(joi => joi.object({
|
||||
// css
|
||||
css: joi.object({
|
||||
modules: joi.boolean(),
|
||||
extract: joi.boolean(),
|
||||
extract: joi.alternatives().try(joi.boolean(), joi.object()),
|
||||
localIdentName: joi.string(),
|
||||
sourceMap: joi.boolean(),
|
||||
loaderOptions: joi.object({
|
||||
|
||||
Reference in New Issue
Block a user