-
Notifications
You must be signed in to change notification settings - Fork 70
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
Bundle CSS into fides.js script, and add styles to DOM from the package #3288
Comments
Yeah- this one needs to land before the "final" release but can wait for the all the components to be working first 👍 |
I've done some research in the past on Rollup plugins for CSS, so here's a quick roundup of options. I like this community-maintained list of plugins: https://github.com/rollup/awesome From here we want a CSS plugin that hits a couple requirements:
Will need to test a few out to be sure, but based strictly on download popularity as a really rough metric (sorry, OSS maintainers!) here's how the list stacks up: ...it's not even close, In the herd of much-less-popular alternatives, this one strikes me as the best option: https://github.com/Anidetrix/rollup-plugin-styles. It is more recently maintained and still is pretty popular as far as npm packages go: So I'd plan to just compare those two plugins and see what I find. |
I took a closer look at https://github.com/Anidetrix/rollup-plugin-styles and, while it's more recently updated, it's also a bit stale and looks like it's fallen out of compatibility with rollup v3 and folks are forking it to maintain it, etc. So I think, unfortunately, the metric of "what has the most weekly downloads?" proves effective yet again...! |
Closed by #3431 |
Current behavior
Currently, rollup bundles the CSS into a separate output in
fides-js/dist/fides.css
.For usage in
privacy-center/public/fides-js-components-demo.html
, we have to copy the CSS file over intoprivacy-center/public/lib/fides.css
so that the page can import it directly in the HTML.For usage in
privacy-center/public/fides-js-demo.html
file, we dynamically insert the css fromfides-js/dist/fides.css
, just like we do the js file fromfides-js/dist/fides.js
. This, specifically, is error-prone.Expected behavior
We should bundle the CSS into
fides-js/dist/fides.js
itself so that we won't need to insert the css at the last minute in the bundle on the privacy center.Proposed Approach
declaration.d.ts
file withdeclare module "*.module.css";
infides-js/src
ConsentBanner.tsx
:privacy-center/public/fides-js-components-demo.html
andprivacy-center/pages/api/fides-js.ts
This currently does not add the styles appropriately, so will need investigation.
Context
Originally posted by @NevilleS in #3191 (comment)
The text was updated successfully, but these errors were encountered: