windicss-intellisense icon indicating copy to clipboard operation
windicss-intellisense copied to clipboard

Extract classes into @apply directive in the corresponding place

Open edimitchel opened this issue 3 years ago • 6 comments

Hi folks !

I'm thinking about a great feature that miss with Tailwind : select a class (the text cursor in the class attribute) and do a command that will take all classes and extract it into the best place. With Vue or Svelte, inside the style block. Otherwise, in another file. The classe name have to be written by the user in sync with the classe attributes value. And so, classes are extracted as well !

If I have time, I will try to code something. But I'll need help !!

edimitchel avatar Mar 20 '21 20:03 edimitchel

#8

alexanderniebuhr avatar Mar 20 '21 20:03 alexanderniebuhr

extraction of all classes into external file already exists as commands. maybe you can hook into it

alexanderniebuhr avatar Mar 20 '21 20:03 alexanderniebuhr

can you elaborate how this can be done? at least in the plugin documentation i did not see such a command :)

eikaramba avatar Apr 16 '21 12:04 eikaramba

@eikaramba it is still a feature yet to be implemented, not had time to tackle this

alexanderniebuhr avatar Apr 16 '21 13:04 alexanderniebuhr

ahh okay, no problem. i will try at the weekend whether i understand the code and help out, as i would like to have this ;)

eikaramba avatar Apr 16 '21 14:04 eikaramba

the existing commands for extracting style, just put them into an css file so to resolve #8 and this issue, we would based on editor opened file put the code generated similar to the existing commands into the exiting / or new <style> </style> tag. another idea is to just add this code into clipboard maybe, then user can paste wherever they need it https://github.com/windicss/windicss-intellisense/blob/c382ae08cb7390bf47dcd12e9185d124ea9c9ffe/src/lib/commands.ts#L18-L53

alexanderniebuhr avatar Apr 16 '21 16:04 alexanderniebuhr