Closed valtido closed 6 years ago
Also maybe have a flag on the settings to turn this feature on/off or turn on/off at save and/or keyup delay
What if there are multiple variables in multiple files with the same value? Should we pick one at random? Should we pick the one in the current file? (If there are multiple in the same file: should we use the first or the last?) I agree it can come in handy at times, but you'll have to be a little more specific on how it should work, before someone can implement it :wink:
Regarding "excluding node_modules of course": are there any more directories we should ignore, like lib
or vendor
directories? That would probably become a setting.
Besides, is this even relevant to the pigments
project? Pigment's goal is to show colours, with additional support for variables in some cases. Converting colour codes to variables is quite the other way around, and I'm afraid pigments
isn't built around that idea, so a major refactor will be needed.
@C-Bouthoorn I started the conversation with would you Consider it as a feature. If not then so be it :).
But if multiple variables are detected (a it should not be the case as that is bad practice) and even if that is the case I am sure a dropdown can be displayed to list multiple icons.
As for the additional directories, a config settings with an array of folders/files to ignore is not a hard thing to do or use git ignore for that matter.
Optionally it could be to specify the folder of all sass files to look into.
Lastly. if this was a separate package, maybe the details do not matter as much as it can progressively evolve :)
I like the idea of this feature, don't get me wrong. I just think pigments is not the best package to add its functionality to. Pigments is mostly about finding and displaying colours, whereas this idea is about finding and replacing colour variables.
I agree there is quite some overlap, but I'm afraid it would take more effort refactoring on pigments's side than it would be to create a new package for it. Pigments already is slow, limited in support, and, frankly, abandoned.
A new and fresh package, which provides support for all kinds of different preprocessors, would be the best way to implement this. That's why I'm closing this issue; definitely not because it's a bad idea (I'd love to help implementing it!), but because it's out of scope for pigments.
Would you guys consider the following feature:
As a user when I type:
body{ color: #990000; }
then Save the file, (or setTimeout on keyup) then the code should convert to the following.
body{ color: $danger; }
Where
$danger
is defined in a separate file within the project folder (excluding node_modules of course).I would do it myself but my knowledge on atom package development is zero.