-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vue cli 3 does not load postcss.config.js or .postcssrc.js #852
Comments
You are placing the directive in the wrong place: https://github.com/twocngdagz/vue-tailwind-select/blob/master/src/App.vue#L23 It should be inside |
To anyone having the same issue despite having placed the directives in the correct place: vue-cli 3 does not pick up on the This article helped me solve the problem. |
@Christoph-Harms I can't get it to work, following the article. Do you happen to have a working example? |
If anyone else has this problem you might be interested in my solution to the problem. The The solution was then to add the This is how my |
@adrian-fjellberg Postcss is supported out-of-the-box in vue-cli 3. |
@Akryum Aha. Of course, it's not correct of me to say:
What I should say is that my problem was related to back when vue-cli used a |
Since version 3.0 |
At the core, this has more to do with vue-loader than vue-cli. Since vue-loader 15, postcss is not applied automatically to all |
Hi @LinusBorg, can you provide a small example to apply postcss to all style tags? |
Oh your misunderstanding. Vue-cli 3 is configured to apply postcss to all style tags. I was me rely stating that this is now done explicitly by adding postcss to the rule that is applied to the styles, not implicitly by vue-loader internally. |
|
I can't make postcss work with a vue-cli 3 generated project. I just followed the wizard and chosed to use separated configuration files. After configured the |
This issue is closed. Open a new one with a reproduction |
aw, why vue cli3 suggests using |
Came here with the same issue in vue-cli 4.5.4, what worked for me was configuring the Create const tailwindcss = require('tailwindcss');
const autoprefixer = require('autoprefixer');
module.exports = {
css: {
loaderOptions: {
postcss: {
plugins: [
tailwindcss,
autoprefixer,
],
},
},
},
} Hope it helps somebody :-) |
Despite trying various of the above answers and lots of googling (webpack configs, postcss configs, adding things to my It's very confusing as to the correct place we need to tell Vue to use PostCSS and autoprefix sass tags in Have created a
Output |
@jamiegdsn They don't care about bugs. |
This is not the place to report bugs or expect answers, as this is a closed ticket @equinusocio @jamiegdsn I would advice you to create a new ticket, create a minimum reproduction of the issue on e.g. codesandbox and share it a link to that in your newly created ticket. Good luck! |
Isn't autoprefixer enabled by default already in vue cli 3? So finnaly what are the ways to add a postCss module or 'postcss-preset-env' in vue?
"postcss": {
i believe both of the above should work in a standard vue 2.x project, although the above still does not work for me, when i have a global style.css file imported in to main.js I sincerely wish the Vue Cookbook or docs would explain this better for newbs, infact most experienced devs still get confused around post css and vue. |
Did you find the solution to this in the end? |
You can add it in vue.config.js autoprefixer is enabled by default, but i am unsure if you edit the css object in vue.config.js if any setting will be overwritten. So all plugin options should be inserted in css.loadOptions.plugins[] At this moment i have disabled purgecss and postcss presets. |
Version
3.0.0-alpha.13
Reproduction link
https://github.com/twocngdagz/vue-tailwind-select
Steps to reproduce
I added a postcss.config.js or postcssrc.js for postcss to load tailwindcss
module.exports = {
plugins: [
require("postcss-import")(),
require("tailwindcss")("./tailwind-config.js"),
require("autoprefixer")(),
]
};
What is expected?
it should process the
@tailwind preflight;
@tailwind utilities;
What is actually happening?
when running vue build src/main.js
style output
#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;margin-top:60px}h3[data-v-2ebf6f26]{margin:40px 0 0}ul[data-v-2ebf6f26]{list-style-type:none;padding:0}li[data-v-2ebf6f26]{display:inline-block;margin:0 10px}a[data-v-2ebf6f26]{color:#42b983}@tailwind preflight;@tailwind utilities;
The text was updated successfully, but these errors were encountered: