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

[Feature Request] Custom dictionary for minification #12

Open
kitsuniru opened this issue Nov 14, 2023 · 4 comments
Open

[Feature Request] Custom dictionary for minification #12

kitsuniru opened this issue Nov 14, 2023 · 4 comments

Comments

@kitsuniru
Copy link

Hi, i would like turf to use my custom symbol dictionary, for example: +, _, - and some like this

@myFavShrimp
Copy link
Owner

Hey, I'm not sure what exactly you mean. Can you please explain what this feature should do and how you are planning to use it?

@kitsuniru
Copy link
Author

kitsuniru commented Nov 17, 2023

@myFavShrimp at the current moment turf generates unique id for each style as a random integer, but i want to use custom symbols, for example, abcdefgh instead of 0123456789
proposal:

[package.metadata.turf.class_names]
template = "<id>"
id_dictionary = ["a","b","c","d","e","f","g","v"]
id_bounds = [3,16]

where:

  • id_dictionary - all possible symbols that can be used in generated id
  • id_bounds - minimum and maximum length for generated id

result:
image

@kitsuniru
Copy link
Author

kitsuniru commented Nov 17, 2023

also, for support wide range of possible symbols in dictionary, we can generate resulting css selectors like this:

[class="{{ generated_name }}"] {{ body_of_style }}
[id="{{ generated_name }}"] {{ body_of_style }}

instead of:

.{{ generated_name }} {{ body_of_style }}
#{{ generated_name }} {{ body_of_style }}

@kitsuniru
Copy link
Author

kitsuniru commented Nov 17, 2023

as a result, we can minify our style names to real shit like this:
image

take a look at <div id = "#">, it was stylized with strange (and sometimes mindbreaking) id - #

js selectors will be like: ##. what's really incredible and a little bit scary

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