Box-Of-Hats / Bem-VSCode-Extension

A VSCode extension for helping with inserting BEM (Block-Element-Modifier) classes.
BSD 3-Clause "New" or "Revised" License
29 stars 5 forks source link

Modify generated scss/css/less code #43

Open furai opened 3 years ago

furai commented 3 years ago

Hey,

Thank you for developing this extension.

I have a question - is there a way to modify the output of generated SCSS? I'd like to add to it some extra default lines that I'm using frequently.

Cheers, Furai

Box-Of-Hats commented 3 years ago

Hi, You're welcome! It isn't currently supported by the extension but it is something that could be added.

Would these lines be something like default imports at the top of the file?

furai commented 3 years ago

In scss I with BEM I find something like:

.component {
    $self: &;

    (...)
}

very useful. But it could be literally anything like some @extend or anything that one uses frequently.

Box-Of-Hats commented 3 years ago

Adding something like that (and having it customizable) would be a lot more difficult than adding default imports. I'm not sure it's something that I can offer with this extension because of how complex that could get

furai commented 3 years ago

Most of extensions provide way to edit base templates which then extensions use to generate their output.

I just thought it's using under the hood some template where you inject "your generated stuff" into slots. If it's done differently then yeah, will be a problem and it's probably not worth the effort.

Thank you for your time taken to review this request.

Box-Of-Hats commented 3 years ago

Do you have any examples of any extensions that offer that so t of templating? It might help me to add this in

furai commented 3 years ago

Hmm, maybe I named it wrongly and it's not templates but snippets? https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables

https://code.visualstudio.com/api/language-extensions/snippet-guide

But you probably know about these. Anyway, feel free to close the issue if don't think it's something possible to do or just too hard. It was just an idea that sprung to my mind. I can use the extension perfectly fine without it. :)

Box-Of-Hats commented 3 years ago

I'll leave it open in case there is a way of including it in the extension. Thanks again for the suggestion, I like the idea!