Vue.js 在 webpack 腳手架中使用 cssnext

Vue.js 的 webpack腳手架默認已經使用了 PostCSS 的 autoprefixer 的功能。css

若是想使用下一代 css語法,即cssnext:webpack

 

1. 安裝依賴git

npm install postcss-cssnext --save-dev

 

2. 修改 .postcssrc.js 文件github

在 plugins 中添加一行,即web

// https://github.com/michael-ciniawsky/postcss-load-config

module.exports = {
  "plugins": {
    "postcss-import": {},
    "postcss-cssnext": {}, // 添加此行
    "postcss-url": {},
    // to edit target browsers: use "browserslist" field in package.json
    "autoprefixer": {}
  }
}

 

3. 重啓 npm run dev 便可npm

 

參考連接:json

cssnextbash

相關文章
相關標籤/搜索