mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 08:02:01 +00:00
refactor: add build.postcss.preset config
This commit is contained in:
parent
f9637a1c86
commit
128dcbe266
@ -43,10 +43,7 @@ export default class PostcssConfig {
|
||||
'postcss-url': {},
|
||||
|
||||
// https://github.com/csstools/postcss-preset-env
|
||||
'postcss-preset-env': {
|
||||
// https://cssdb.org/#staging-process
|
||||
stage: 2
|
||||
},
|
||||
'postcss-preset-env': this.preset || {},
|
||||
'cssnano': this.dev ? false : { preset: 'default' }
|
||||
}
|
||||
}
|
||||
@ -114,6 +111,10 @@ export default class PostcssConfig {
|
||||
|
||||
// Apply default plugins
|
||||
if (isPureObject(config)) {
|
||||
if (config.preset) {
|
||||
this.preset = config.preset
|
||||
delete config.preset
|
||||
}
|
||||
_.defaults(config, this.defaultConfig)
|
||||
|
||||
this.loadPlugins(config)
|
||||
|
@ -76,7 +76,12 @@ export default {
|
||||
},
|
||||
transpile: [], // Name of NPM packages to be transpiled
|
||||
vueLoader: {},
|
||||
postcss: {},
|
||||
postcss: {
|
||||
preset: {
|
||||
// https://cssdb.org/#staging-process
|
||||
stage: 2
|
||||
}
|
||||
},
|
||||
templates: [],
|
||||
watch: [],
|
||||
devMiddleware: {},
|
||||
|
@ -74,7 +74,6 @@
|
||||
"@nuxtjs/babel-preset-app": "^0.3.0",
|
||||
"@nuxtjs/friendly-errors-webpack-plugin": "^2.0.2",
|
||||
"@nuxtjs/youch": "^4.2.3",
|
||||
"autoprefixer": "^8.6.5",
|
||||
"babel-loader": "^8.0.0-beta",
|
||||
"cache-loader": "^1.2.2",
|
||||
"caniuse-lite": "^1.0.30000874",
|
||||
|
10
test/fixtures/with-config/nuxt.config.js
vendored
10
test/fixtures/with-config/nuxt.config.js
vendored
@ -72,6 +72,16 @@ export default {
|
||||
return Object.assign({}, config, {
|
||||
devtool: 'nosources-source-map'
|
||||
})
|
||||
},
|
||||
postcss: {
|
||||
preset: {
|
||||
features: {
|
||||
'custom-selectors': true
|
||||
},
|
||||
autoprefixer: {
|
||||
grid: true
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
css: [{ src: '~/assets/app.css' }],
|
||||
|
13
yarn.lock
13
yarn.lock
@ -1216,17 +1216,6 @@ autoprefixer@^8.5.0:
|
||||
postcss "^6.0.22"
|
||||
postcss-value-parser "^3.2.3"
|
||||
|
||||
autoprefixer@^8.6.5:
|
||||
version "8.6.5"
|
||||
resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-8.6.5.tgz#343f3d193ed568b3208e00117a1b96eb691d4ee9"
|
||||
dependencies:
|
||||
browserslist "^3.2.8"
|
||||
caniuse-lite "^1.0.30000864"
|
||||
normalize-range "^0.1.2"
|
||||
num2fraction "^1.2.2"
|
||||
postcss "^6.0.23"
|
||||
postcss-value-parser "^3.2.3"
|
||||
|
||||
aws-sign2@~0.7.0:
|
||||
version "0.7.0"
|
||||
resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8"
|
||||
@ -1725,7 +1714,7 @@ caniuse-api@^3.0.0:
|
||||
lodash.memoize "^4.1.2"
|
||||
lodash.uniq "^4.5.0"
|
||||
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000864, caniuse-lite@^1.0.30000865, caniuse-lite@^1.0.30000874:
|
||||
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000865, caniuse-lite@^1.0.30000874:
|
||||
version "1.0.30000874"
|
||||
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000874.tgz#a641b1f1c420d58d9b132920ef6ba87bbdcd2223"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user