How can I use precss in vue-loader at a vue-cli programme?
mov1er opened this issue · 5 comments
Here is code:
postcss: [
require('postcss-cssnext')(), //postcss is working if I only write this row.
require('precss')().process({ parser: require('postcss-scss') }) //npm got error when I add this row
]
Here is error log:
Module build failed: Error: PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.
It seems every .vue file got same error?... I'm dont understand,pls, someone help me.
i have the same problem, when precss is updated to version 2.0, the usage has been changed, so i run the code npm install precss@1.4.0
to re-install fecss history version, and the config code: postcss: [require('precss')()]
. the problem was solved.
i revert back to precss^1.4.0,but still got errors.
ERROR Failed to compile with 2 errors 15:14:45
These relative modules were not found:
- ../images/sel_button_star_selected.png in ./
/_css-loader@0.26.4@css-loader?{"minimize":false,"sourceMap":false}!.//_vue-loader@11.3.4@vue-loader/lib/style-compiler?{"id":"data-v-17909057","scoped":fals
e,"hasInlineConfig":true}!.//_vux-loader@1.0.64@vux-loader/src/after-less-loader.js!.//_less-loader@2.2.3@less-loader?{"sourceMap":false}!.//_vux-loader@1.0.64@vux-loader/src/style-loader.js!.//_vue-lo
ader@11.3.4@vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue - ../images/sel_button_star_default.png in ./
/_css-loader@0.26.4@css-loader?{"minimize":false,"sourceMap":false}!.//_vue-loader@11.3.4@vue-loader/lib/style-compiler?{"id":"data-v-17909057","scoped":false
,"hasInlineConfig":true}!.//_vux-loader@1.0.64@vux-loader/src/after-less-loader.js!.//_less-loader@2.2.3@less-loader?{"sourceMap":false}!.//_vux-loader@1.0.64@vux-loader/src/style-loader.js!.//_vue-loa
der@11.3.4@vue-loader/lib/selector.js?type=styles&index=0!./src/App.vue
some static images cannot be found?
@wendaosanshou
If you want to introduce a picture in a css file, you can reference the postcss plugin postcss-url
, just npm install postcss-url --save-dev
and the config code postcss: [require('postcss-url')()]
.
i not sure for the reason, you can try it.
I have not found your problem when i introduce a picture as a background image.
If someone would like to make a PR to add sample vue configuration like we have for Gulp and Grunt, then I would be open to adding it to the README.