Skip to content
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

Swap out css package for more recent alternative? #325

Open
prescience-data opened this issue May 12, 2022 · 3 comments
Open

Swap out css package for more recent alternative? #325

prescience-data opened this issue May 12, 2022 · 3 comments

Comments

@prescience-data
Copy link

prescience-data commented May 12, 2022

PNPM throws constant deprecation warnings about source-map-resolve which is due to the css dependency.

Looking at this source-map-resolve package it doesn't appear to have been updated in ~2 years, so potentially work looking into more current alternatives such as:

@wtho
Copy link
Owner

wtho commented May 13, 2022

Good point. Do you have any recommendations on any of the libraries?

The functionality we need is:
Parse CSS to AST, traverse it to find declarations where CSS variable is used and manipulate the AST there

PRs are welcome!

@prescience-data
Copy link
Author

prescience-data commented May 13, 2022

I would need to dig into the code to really work out a good fit - are there any main entrypoints in lib I should look at first?

I've used css-what a few times before and it seems quite fast but would hesitate to recommend it without more context / understanding of the codebase.

@stafyniaksacha do you have any thoughts given its part of your team's themes?

@wtho
Copy link
Owner

wtho commented May 13, 2022

It is all just in lib/src/css-post-processor.ts.

The code there is only used to create a css file with the default values in case a browser (IE basically) does not support CSS variables. When traversing the AST it looks for CSS variable declarations (declaration values that start with --var() and replaces them with the initial values set in the bulma css vars config file.

So I think we have two options:

  • remove the fallback (as we assume all used browsers can handle CSS variables)
  • replace css with some other, more up-to-date library (to me css-tree looks the best api-wise after a short glance)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants