postcss-variable-compress icon indicating copy to clipboard operation
postcss-variable-compress copied to clipboard

CSS variable name changes every build

Open tonyfromundefined opened this issue 11 months ago • 8 comments

스크린샷 2023-07-09 오후 4 52 06

Therefore, there is a problem that chunk hash keeps changing. due to that issue

  • Unable to use one build for multiple stages
  • Chunk hash keeps changing to reduce cache hit rate every time it is distributed.

I ask for your help so that it can be a definitive build without side effects.

tonyfromundefined avatar Jul 09 '23 07:07 tonyfromundefined

@tonyfromundefined If you are looking for a plugin that can work on separate files go to import splitFiles.js, works the same but it doesn't resets the variables.

It is in the description, if it doesn't work please let me know

navanshu avatar Jul 09 '23 10:07 navanshu

It might help, but it based on the order of variable, It doesn't preserve the compression across builds

navanshu avatar Jul 09 '23 10:07 navanshu

@tonyfromundefined I will look into it.

navanshu avatar Jul 09 '23 10:07 navanshu

It helps! But as you said, it doesn't seem to completely solve the problem... Is there a reason you used the global variable count implementation instead of compressing or hashing the variable names?

tonyfromundefined avatar Jul 10 '23 01:07 tonyfromundefined

Will be releasing update it tomorrow

navanshu avatar Jul 10 '23 03:07 navanshu

@tonyfromundefined I used counter since, it is easier and quite efficient, no algorithm can provide such compression

navanshu avatar Jul 10 '23 03:07 navanshu

https://github.com/navanshu/postcss-variable-compress#to-utilize-the-history--same-variables-accross-builds-effectively-follow-these-steps

Oh, it seems really smart to codegen the mapping information and cache it in git. It seems like a good idea, so I'm looking forward to it. 👍

It seems to be similar to Persisted Query in GraphQL 😂

tonyfromundefined avatar Jul 16 '23 14:07 tonyfromundefined

@tonyfromundefined 🤣 code-gen for css variables, I can see feel the terror

navanshu avatar Jul 17 '23 15:07 navanshu