Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does emmet allow boolean attributes?

When I type the following text into an editor that understands emmet:

div.fragment>pre>code.javascript[contenteditable]

it expands to:

<div class="fragment">
    <pre><code class="javascript" contenteditable=""></code></pre>
</div>

Which is almost perfect, except that the boolean attribute shouldn't have the quotes. Is there a way to write the shortcut so that it expands properly like this:

<div class="fragment">
    <pre><code class="javascript" contenteditable></code></pre>
</div>
like image 353
planetoftheweb Avatar asked Jul 02 '26 03:07

planetoftheweb


1 Answers

As of October 2013 this is now possible.

input[type=checkbox checked.]

Typing a single period (.) directly after the boolean attribute will produce the following output by default:

<input type="checkbox" checked="checked" />

If you want Emmet to output the attribute name without the argument e.g.

<input type="checkbox" checked />

You'll need to add the following key-value pair to the 'html' object in your Emmet user settings (Mac: 'Sublime Text' > 'Preferences' > 'Package Settings' > 'Emmet' > 'Settings - User')

"compact_bool": true
like image 103
Kyle G Avatar answered Jul 04 '26 18:07

Kyle G



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!