mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-19 01:45:53 +00:00
Add build.postcss option
This commit is contained in:
parent
fc598ea66e
commit
57b55dc512
@ -43,7 +43,8 @@ const defaults = {
|
||||
vendor: [],
|
||||
loaders: [],
|
||||
plugins: [],
|
||||
babel: {}
|
||||
babel: {},
|
||||
postcss: []
|
||||
}
|
||||
const defaultsLoaders = [
|
||||
{
|
||||
@ -63,14 +64,18 @@ const defaultsLoaders = [
|
||||
}
|
||||
}
|
||||
]
|
||||
const defaultsPostcss = [
|
||||
require('autoprefixer')({
|
||||
browsers: ['last 3 versions']
|
||||
})
|
||||
]
|
||||
|
||||
module.exports = function * () {
|
||||
// Defaults build options
|
||||
if (this.options.build && Array.isArray(this.options.build.loaders)) {
|
||||
this.options.build = _.defaultsDeep(this.options.build, defaults)
|
||||
} else {
|
||||
this.options.build = _.defaultsDeep(this.options.build, defaults, { loaders: defaultsLoaders })
|
||||
}
|
||||
let extraDefaults = {}
|
||||
if (this.options.build && !Array.isArray(this.options.build.loaders)) extraDefaults.loaders = defaultsLoaders
|
||||
if (this.options.build && !Array.isArray(this.options.build.postcss)) extraDefaults.postcss = defaultsPostcss
|
||||
this.options.build = _.defaultsDeep(this.options.build, defaults, extraDefaults)
|
||||
if (!this.options._build && !this.options._renderer) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
@ -2,11 +2,7 @@
|
||||
|
||||
module.exports = function () {
|
||||
let config = {
|
||||
postcss: [
|
||||
require('autoprefixer')({
|
||||
browsers: ['last 3 versions']
|
||||
})
|
||||
],
|
||||
postcss: this.options.build.postcss,
|
||||
loaders: {
|
||||
'js': 'babel-loader?presets[]=es2015&presets[]=stage-2',
|
||||
'postcss': 'vue-style-loader!css-loader',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nuxt",
|
||||
"version": "0.6.6",
|
||||
"version": "0.6.7",
|
||||
"description": "A minimalistic framework for server-rendered Vue.js applications (inspired by Next.js)",
|
||||
"main": "index.js",
|
||||
"license": "MIT",
|
||||
@ -9,8 +9,6 @@
|
||||
"nuxt": "./bin/nuxt"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "DEBUG=nuxt:* bin/nuxt",
|
||||
"dev": "DEBUG=nuxt:* nodemon bin/nuxt",
|
||||
"test": "npm run lint",
|
||||
"lint": "eslint --ext .js,.vue bin lib pages test index.js --ignore-pattern lib/app",
|
||||
"precommit": "npm run lint"
|
||||
|
Loading…
Reference in New Issue
Block a user