-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use with PostCSS? #18
Comments
It does not work for PostCSS files, correctly. Can you give an example of possible usage? |
Just like sass, I save postcss variables in a file. I'm OK to import where required (I've done it 18 months w/ Nuxt) but it'd be great to use this module instead. |
@callumflack Looks like a doable thing! |
@manniL that would be very cool! Thankyou |
@callumflack Do you use a plugin for PostCSS variables? |
@manniL yes, I use |
@callumflack But Can you give me an example how your files would look like (similar to the fixtures for LESS/SASS/Stylus in the repo)? |
@manniL sure, here's an example.
I'm not sure how Is that what you mean? It gets quite nuanced. Ps. I use a |
@manniL btw, I actually npm import a package of css utilities across all my projects, check it here: https://github.com/callumflack/iremono And this is a good example of a project it's used within: https://github.com/callumflack/callum-flack-design |
I think you should not care about what plugins are used. For example, i use |
@callumflack Thank you so much! It’s been two hours I try to figure out how to |
Are there any updates on this? I am using PostCSS with precss plugin, which includes PostCSS Advanced Variables to allow for Sass-like variables, conditionals and iterators. I'm currently using @import statements in each component, but would like to be able to include my variables file and a few mixins in all components by default. |
Had no time to work on it yet, nope 😦 |
I still have all my custom media queries and custom properties in my postcss.config like in the answer here: Do you think that this could be done, so that the variables could be in a .css file instead? |
Has there been any progress on this? |
When using postcss variables and mixins in Assets folder (as .css files) I can import those in each <style> section with @import "<path to .css file>". It would be awesome to be able to simply define postcss in nuxt.config.js in same way as scss. I guess this is the aim of this plug-in and postcss seems to be widely used. Is there maybe any other way in nuxt to "auto-include" global variable and mixins for postcss so we do not have to import those in each .vue file? |
@CMQNordic in your Here's my setup: css: [
{ src: '~assets/css/_normalize.css' },
{ src: '~assets/css/_fonts.css' },
{ src: '~assets/css/_grid.css' },
{ src: '~assets/css/_base.css' },
],
...
build: {
extractCSS: { ignoreOrder: true },
optimizeCSS: true,
postcss: {
plugins: {
'postcss-mixins': {},
'postcss-import': {},
'postcss-nested': {},
'postcss-partial-import': {},
'postcss-custom-properties': {
importFrom: './assets/css/_variables.css',
preserve: false,
},
'postcss-reporter': {},
'postcss-custom-media': {
importFrom: './assets/css/_variables.css',
preset: {
browsers: 'last 2 versions, ie >= 11',
stage: 0,
},
},
},
}, |
Wondering if this will work with the variables / mixins from |
Doesn't seem to be working for PostCSS files. Does it? Can it?
The text was updated successfully, but these errors were encountered: