-
Notifications
You must be signed in to change notification settings - Fork 61
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
Define global variables as css file #60
Comments
Yes! This is what I've been trying to do - just reference a "global_variables.css" file that has my variables, custom-media, mixins, etc. and have webpack/postcss deliver them to all my app pages/components without me having to explicitly @import that file into every other CSS file in my app. |
This would be great. We have a project structure with separate CSS files for each component, and currently we have to duplicate the shared CSS custom props in every CSS file to enable IE11. The bloat really adds up. |
This is still an issue, and given I have css modules, this prevents me from using this plugin, the custom-properties plugin has a |
@mbulfair Pull request welcome |
Need this functionality for people using css-modules |
@MadLittleMods I really need this and would like to start working on a PR. Could you give me some hints on how you would approach this problem? |
@damianfrizzi Some rough overview,
|
any update about this implement? |
Is there any other solution to solve this? |
My solution has been to just point to a css file and not use this plugin anymore. Unless you have IE as a requirement, custom properties are fully supported now. https://caniuse.com/css-variables
|
It's just a suggestion for implement.
Now global variables defined as 'variables' in options. And it is an js object.
For me it would be better to import variables as file instead, for example:
P.S. Why I need it:
It's because I use css-modules and have no way to set variables declarations somewhere top.
It is possible to import variables from every file which needs them, but I'm using variables as a method to decouple components from global files :) As a context for component...
The solution I use for now is implicitly importing of variables file in sass-loader.
The text was updated successfully, but these errors were encountered: