csstools/precss

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:

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.