emmet icon indicating copy to clipboard operation
emmet copied to clipboard

Add stylesheet to !html abbreviation

Open LukasSkywalker opened this issue 2 years ago • 5 comments

Since probably a large part of websites generated with emmet need to link a stylesheet, this adds a default css link to the ! html abbreviation.

LukasSkywalker avatar Oct 16 '23 13:10 LukasSkywalker

<link> is not required if you build web-site with some popular frameworks, which use import 'style.css' notation to include preprocessed styles.

It’s better if user customize snippets like that in their editors

sergeche avatar Oct 16 '23 14:10 sergeche

@sergeche what frameworks are you implying? Your import suggests the code is written in JS or TS files (something like Vue, React and the like). I might be wrong, but wouldn't Emmet autocomplete only in plain HTML files anyway?

LukasSkywalker avatar Oct 17 '23 05:10 LukasSkywalker

Yes, Emmet should autocomplete in plain HTML files. And if users build web-sites with frameworks, your change will force them to always remove <link> they don’t need.

Also, its implied that such changes should be make in user space, e.g. user can update snippets for his own instance, not for every Emmet user

sergeche avatar Oct 17 '23 09:10 sergeche

I think we are misunderstanding each other. You claim:

And if users build web-sites with frameworks, your change will force them to always remove they don’t need.

What framework uses plain HTML files?

LukasSkywalker avatar Nov 03 '23 17:11 LukasSkywalker

In SvelteKit, the entry HTML page doesn’t contain any stylesheet references. As well as Vite entry page.

But my claim is not about frameworks, it’s about good defaults for most users. I don’t need any external stylesheet if I want to create a page to play with inline styles. But if your workflow requires external stylesheet for most cases, you should change this snippet for yourself, not for every Emmet user.

sergeche avatar Nov 05 '23 10:11 sergeche