JavaScript Developer Toolkit - Emmet


This is a second article about JavaScript developer's toolkit and today we're going to talk about Emmet. If you've missed the first article about the useful tools for JavaScript developers, have a look at it here.

What is Emmet?


Essentially it gives you shortcuts you can type that expand into full HTML or CSS. Like nav>a*5 will expand into a <nav> tag with eight links inside it with empty hrefs.
<nav>
 <a href=""></a>
 <a href=""></a>
 <a href=""></a>
 <a href=""></a>
 <a href=""></a>
</nav>
Or, try div.module*2>p*2>lorem and press tab. Firstly it will convert div.module*2 into two <div> elements and associate them with a module css class. After that it will look at >p*2 and create two <p> elements. In the end >lorem will fill the paragraphs with famous lorem ipsum text. Take a look at the produced code below:
<div class="module">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
     Accusantium aliquid, autem eligendi explicabo possimus
        similique vitae! Asperiores ducimus ea illum perspiciatis
        placeat similique soluta, totam! Alias aut maiores
        omnis quo.
    </p>
    <p>Ab alias aspernatur eius, ex natus non obcaecati quo
     veritatis voluptatem voluptatum? Ab assumenda consectetur
        deserunt, doloremque ea et odio. Animi beatae eaque facere
        itaque nemo nobis obcaecati quis sequi.
    </p>
</div>
<div class="module">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.
     Ad aperiam eos esse explicabo nostrum, numquam rem
        veniam. Blanditiis commodi cum error eum incidunt ipsam
        laboriosam natus quod veritatis voluptate, voluptatibus?
 </p>
    <p>Ab architecto atque deleniti dicta dolor dolores, enim
     explicabo ipsum, libero natus nulla officiis, rerum
        tempora temporibus unde! Aliquid aspernatur eaque fuga
        molestiae nisi omnis quis repellendus reprehenderit sunt
        voluptatum.
    </p>
</div> 
There are also a bunch of editor navigation shortcuts like move to the next edit point, reflect css value, split/join tag and more. All of them are beautifully demonstrated on Emmet documentation section and even can be played with.

Emmet works with various code editors and is already bundled-in with Webstorm. It can as well be easily installed on Sublime Text, of which we talked in our previous article.

Check out for the next article in the series of developer toolkit. In fact I think I'm going to keep the tradition and post an article about the useful tools every first weekend of the month.

Comments

Popular posts from this blog

Rust Static Analysis and Blockchain Licensing

Length extension attack

CAP Theorem and blockchain