Git Product home page Git Product logo

emmet-cli's Introduction

emmet-cli

emmet command line interface.

Usage

$ emmet abbr
$ echo abbr | emmet

Examples:

$ emmet '#foo>span.bar*3'

outputs on stdout:

<div id="foo">
  <span class="bar"></span>
  <span class="bar"></span>
  <span class="bar"></span>
</div>

$ echo '!' | emmet

outputs on stdout:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>Document</title>
</head>
<body>
	
</body>
</html>

Use the -p flag to include placeholders in the output:

$ echo '#foo>span.bar*3' | emmet -p

outputs on stdout:

<div id="foo">
	<span class="bar">${1}</span>
	<span class="bar">${2}</span>
	<span class="bar">${3}</span>
</div>

These syntax should be compatible with snippets formats like the one used by lsp servers

Install

$ npm i -g emmet-cli
$ yarn global add emmet-cli

About

emmet is a great plugin available in many modern code editors. It aims mainly at working with HTML easier.

It's written in JavaScript so there's no easy way run it without node.js.

This module is currently a dead simple (like 10 lines of code) way to use the compiler as a CLI. It uses a few modules from @emmet-io which is an effort for emmet 2.x to decouple all its internal bits.

My main usage currently is with kakoune's ! command which blindly insert the output of emmet into the current buffer or the | command which pipes selections contents to emmet's stdin.

In the future, I'll try to improve this scenario further by combining with cool stuff like phantom selectons.

According to its README, the HTML matcher would be a nice way to grab coordinates that may be turned into text-objects, but the findPair function is nowhere to be found (yet).

See Also

License

ISC

emmet-cli's People

Contributors

delapouite avatar dependabot[bot] avatar jjk96 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

jtrv

emmet-cli's Issues

Not supported snippets

I've found your CLI very useful but also limited. For example some snippets from the emmetio cheat-sheet page doesn't work. Like for example almost all aliases doesn't work properly except e.g. html:5 which is OK, but for example html:4s doesn't. The second is an alias of the snippet !!!4s+doc4[lang=${lang}] and if I use the snippet directly, emmet-cli also produce incorrect output. But if I use the "html:5" alias snippet, which is !!!+doc[lang=${lang}] it works. Are they hardcoded or the included emmetio libraries are old? Can you please help with that?

Also an emmet -v could help a little if that would possible.

input from CLI args not working

When I try to use the example from the docs:

emmet '#foo>span.bar*3'

The console never returns, it just sits there as if expecting input. If I use the piped example all is as expected.

Having to always pipe is very annoying, it would be great if this little bug could be nipped in the bud.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.