better-emmet-plugin

Emmet abbreviation parser for better-dom

Usage no npm install needed!

<script type="module">
  import betterEmmetPlugin from 'https://cdn.skypack.dev/better-emmet-plugin';
</script>

README

better-emmet-plugin
NPM version NPM downloads Build Status Coverage Status Bower version

Emmet abbreviation parser for better-dom

Html strings are annoyingly verbose. Let's fix that with Emmet. Compare the HTML string:

DOM.create("<ul><li class='list-item'></li><li class='list-item'></li><li class='list-item'></li></ul>");

to the equivalent micro template

DOM.create(DOM.emmet("ul>li.list-item*3"));

Take a look at the Emmet cheat sheet for more examples, but be aware about the differences.

Differences from emmet.io parser

  1. Element aliases are not supported
  2. Implied tag names are not supported
  3. a{text} instead of a>{text} is not supported
  4. Operator ^ is not supported
  5. Expandos are not supported
  6. Boolean attributes (attributes are boolean by default)
  7. Default attributes are not supported
  8. Short tags are not supported

Do not be crazy with microtemplates!

Several recommendations from the emmet docs:

Abbreviations are not a template language, they don’t have to be “readable”, they have to be “quickly expandable and removable”.

You don’t really need to write complex abbreviations. Stop thinking that “typing” is the slowest process in web-development. You’ll quickly find out that constructing a single complex abbreviation is much slower and error-prone than constructing and typing a few short ones.

Browser support

Desktop

  • Chrome
  • Safari 6.0+
  • Firefox 16+
  • Opera 12.10+
  • Internet Explorer 8+ (see notes)

Mobile

  • iOS Safari 6+
  • Android 2.3+
  • Chrome for Android