Closed lukidoescode closed 2 weeks ago
Please don't be scared of the amount of changes. Most of it comes from copying and slightly modifying an example. And from all the changes in the lock files.
Also, please squash merge. I imagine my commit messages would otherwise be pretty nonsensical.
Sorry, I had to make some updates after having used this directly from git in my own project.
I also increased the density of the hashes by base64 encoding them, instead of the previous hex encoding with its limited alphabet. Just to make using the short hashes more feasible by avoiding possible collisions.
Thank you very much for creating the pr! I will review it within the next few days when find some free time
I created a new release 0.9.4
which includes your changes. Thank you very much again for your contribution!
Thanks for merging! It was my pleasure!
What
This PR introduces four new placeholders into the template config:
<name_hash>
will be replaced with the hash of the original class name from the SCSS file<name_hash_short>
will be replaced with the first 5 characters of the hash of the original class name from the SCSS file<style_sheet_hash>
will be replaced with the hash of the SCSS file<style_sheet_hash_short>
will be replaced with the first 8 characters of the hash of the SCSS fileWhy
I found the file output feature of turf to be quite unusable, because the IDs generated by the
<id>
template placeholder would change upon every visit. That means that when using the<id>
placeholder, the<id>
generated in the output file would not match the<id>
returned by the macro for use in e.g. my leptos code.That's why I felt the need to introduce a deterministic and obfuscated differentiator for the source file names, as well as for the class names. This allows the same class name, e.g.
.container
, in multiple files. The<id>
achieves the same result, but not in a deterministic manner.The reason for adding short versions is because it is the web and size does matter.
Seeing is believing