Skip to content

Instantly share code, notes, and snippets.

@sandiprb
Created October 26, 2018 13:23
Show Gist options
  • Save sandiprb/46481cad62c870992477d9f112578de1 to your computer and use it in GitHub Desktop.
Save sandiprb/46481cad62c870992477d9f112578de1 to your computer and use it in GitHub Desktop.
postcss rc for vue js
const path = require('path')
module.exports = {
plugins: {
"postcss-import": {
resolve(id, basedir) {
// resolve alias @css, @import '@css/style.css'
// because @css/ has 5 chars
if (/^@css/.test(id)) {
return path.resolve('./src/assets/css', id.slice(5))
}
// resolve node_modules, @import '~normalize.css/normalize.css'
// similar to how css-loader's handling of node_modules
if (/^~/.test(id)) {
return path.resolve('./node_modules', id)
}
// resolve relative path, @import './components/style.css'
return path.resolve(basedir, id)
}
},
"postcss-mixins": {},
"postcss-simple-vars": {},
"postcss-color-function": {},
"postcss-nested": {},
"postcss-extend": {},
"postcss-discard-comments": {},
"postcss-discard-empty": {},
"autoprefixer": {
"browsers": "> 1%, IE 6, Explorer >= 10, Safari >= 7"
},
"cssnano": {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment