mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
Merge pull request #2617 from clarkdo/postcss-import-alias
feat: use ~ with postcss-import
This commit is contained in:
commit
9c568afb2d
@ -1,7 +1,8 @@
|
|||||||
const { existsSync } = require('fs')
|
const { existsSync } = require('fs')
|
||||||
const { resolve } = require('path')
|
const { resolve, join } = require('path')
|
||||||
const { cloneDeep } = require('lodash')
|
const { cloneDeep } = require('lodash')
|
||||||
const { isPureObject } = require('../../common/utils')
|
const { isPureObject } = require('../../common/utils')
|
||||||
|
const createResolver = require('postcss-import-resolver')
|
||||||
|
|
||||||
module.exports = function postcssConfig() {
|
module.exports = function postcssConfig() {
|
||||||
let config = cloneDeep(this.options.build.postcss)
|
let config = cloneDeep(this.options.build.postcss)
|
||||||
@ -47,12 +48,19 @@ module.exports = function postcssConfig() {
|
|||||||
plugins: {
|
plugins: {
|
||||||
// https://github.com/postcss/postcss-import
|
// https://github.com/postcss/postcss-import
|
||||||
'postcss-import': {
|
'postcss-import': {
|
||||||
root: this.options.rootDir,
|
resolve: createResolver({
|
||||||
path: [
|
alias: {
|
||||||
|
'~': join(this.options.srcDir),
|
||||||
|
'~~': join(this.options.rootDir),
|
||||||
|
'@': join(this.options.srcDir),
|
||||||
|
'@@': join(this.options.rootDir)
|
||||||
|
},
|
||||||
|
modules: [
|
||||||
this.options.srcDir,
|
this.options.srcDir,
|
||||||
this.options.rootDir,
|
this.options.rootDir,
|
||||||
...this.options.modulesDir
|
...this.options.modulesDir
|
||||||
]
|
]
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
// https://github.com/postcss/postcss-url
|
// https://github.com/postcss/postcss-url
|
||||||
|
@ -141,6 +141,7 @@
|
|||||||
"jsdom": "^11.5.1",
|
"jsdom": "^11.5.1",
|
||||||
"json-loader": "^0.5.7",
|
"json-loader": "^0.5.7",
|
||||||
"nyc": "^11.4.1",
|
"nyc": "^11.4.1",
|
||||||
|
"postcss-import-resolver": "^1.1.0",
|
||||||
"puppeteer": "^1.0.0",
|
"puppeteer": "^1.0.0",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
"request-promise-native": "^1.0.5",
|
"request-promise-native": "^1.0.5",
|
||||||
|
@ -2549,7 +2549,7 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
once "^1.4.0"
|
once "^1.4.0"
|
||||||
|
|
||||||
enhanced-resolve@^3.4.0:
|
enhanced-resolve@^3.4.0, enhanced-resolve@^3.4.1:
|
||||||
version "3.4.1"
|
version "3.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e"
|
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-3.4.1.tgz#0421e339fd71419b3da13d129b3979040230476e"
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -5779,6 +5779,12 @@ postcss-image-set-polyfill@^0.3.5:
|
|||||||
postcss "^6.0.1"
|
postcss "^6.0.1"
|
||||||
postcss-media-query-parser "^0.2.3"
|
postcss-media-query-parser "^0.2.3"
|
||||||
|
|
||||||
|
postcss-import-resolver@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/postcss-import-resolver/-/postcss-import-resolver-1.1.0.tgz#08a1a9811da625d28317abc31565a8408ff28cd2"
|
||||||
|
dependencies:
|
||||||
|
enhanced-resolve "^3.4.1"
|
||||||
|
|
||||||
postcss-import@^11.0.0:
|
postcss-import@^11.0.0:
|
||||||
version "11.0.0"
|
version "11.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-11.0.0.tgz#a962e2df82d3bc5a6da6a386841747204f41ef5b"
|
resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-11.0.0.tgz#a962e2df82d3bc5a6da6a386841747204f41ef5b"
|
||||||
|
Loading…
Reference in New Issue
Block a user