astroturfcss / astroturf

Better Styling through Compiling: CSS-in-JS for those that want it all.
https://astroturfcss.github.io/astroturf/
MIT License
2.28k stars 59 forks source link

Global import #608

Open GTDev87 opened 4 years ago

GTDev87 commented 4 years ago

Hey, so I've integrated astroturf into my project and I'm curious if there is a way to use global imports.

I have added postcss and have tried using https://github.com/scherebedov/postcss-global-import#readme but it doesn't seem to handle when imports have imports.

Looks like the following:

css`
  @global-import "./css/global.css";
  @global-import "react-table/react-table.css";
  @global-import "bootstrap/dist/css/bootstrap.css";
`;

I don't think it is possible to wrap :global around an entire import.

Thanks

jquense commented 4 years ago

What are you trying to accomplish? :global is a css-modules construct it wouldn't affect imports. and if the issue is that imported styles are being "modularized" that not because an astroturf file is importing it it'd be because your build setup is matching all css files as css modules. The common convention is to only test files with .module.css extension for modules