Reality:
In WebStorm (v.10.0.4), as in many other IDEs/text editors table.table.table-striped
+ tab
saves you some time and characters to obtain <table class="table table-striped"></table>
.
There is similar functionality for id
attribute: div#one
-> <div id="one"></div>
.
With Bootstrap this works quite good. But with Angular Material, which has many custom attributes on elements, this is not sufficient.
Question:
Is there a way to define in WebStorm a kind of regex similar to <tag>.<className>
to dynamically generate tags with attributes instead of CSS classes?
What I've done so far:
I've looked to Live Templates, but they can define only static templates, which means I have to hardcode every possible tag-attribute pair. Also I couldn't find where the <tag>.<className>
functionality resides in in order to build something on top of that.
This functionality is based on Emmet abbreviations. See https://www.jetbrains.com/webstorm/help/emmet-support.html, https://www.jetbrains.com/webstorm/help/expanding-emmet-templates-with-user-defined-templates.html for more information about Emmet support in WebStorm.
In particular, to generate HTML element with certain attributes, you need using tag_name[attr=value]
syntax,
like: link[rel=prefetch title="Hello world"]
to generate <link rel="prefetch" href="" title="Hello world">