Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juliendargelos/emmet.js
Use emmet syntax with javascript
https://github.com/juliendargelos/emmet.js
Last synced: 4 days ago
JSON representation
Use emmet syntax with javascript
- Host: GitHub
- URL: https://github.com/juliendargelos/emmet.js
- Owner: juliendargelos
- License: gpl-3.0
- Created: 2016-03-18T16:37:01.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-03-18T18:20:13.000Z (almost 9 years ago)
- Last Synced: 2024-11-11T05:39:55.488Z (2 months ago)
- Language: JavaScript
- Size: 41 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Emmet.js
Use emmet syntax with Javascript.### Version
Beta 1### Licence
Emmet.js is under GNU General Public License v3.0.### Requirements
Emmet.js does not require anything.### Installation
Just include the script in your HTML page:
```html```
Or, using the minified version:
```html```
### Using
Emmet.js is based on the emmet syntax so [just use it](http://docs.emmet.io/abbreviations/syntax/). **Be careful, Emmet.js does not support grouping as emmet does with parenthesises**. In these examples, Node objects are represented by their HTML syntax, but they are Node objects!Create a div:
```javascript
var div=emmet('div');
// Returns:
```Create one hundred div-s:
,,...,]
```javascript
var divs=emmet('div*100');
// Returns: [
```Create one hundred div-s incrementing the id (works with any attribute):
,,...,]
```javascript
var divs=emmet('div*100#d$');
// Returns: [
```Create one hundred div-s decrementing the id:
,,...,]
```javascript
var divs=emmet('div*100#d$@-');
// Returns: [
```Create a span with text "Hello" inside a div:
```javascript
var divAndSpan=emmet('div>span{Hello}');
// Returns:Hello
```You can use Emmet.js from any Node in the DOM so it directly appends the element(s) inside the Node (and return the element(s) as previously):
```javascript
document.body.emmet('div');
// Appends a div in the body and returns:
```Furthermore, you can also use Emmet.js from any NodeList to directly append the element(s) inside each Node in the NodeList:
```javascript
document.getElementsByTagName('div').emmet('span');
// Append a span inside each div of the document
```To have a more complete documentation, just go to [docs.emmet.io](http://docs.emmet.io/abbreviations/syntax/).
### Development
Emmet.js is open to any kind of contribution :)