Skip to content
/ yo-yoify Public

Transform choo, yo-yo or bel template strings into pure and fast document calls

Notifications You must be signed in to change notification settings

shama/yo-yoify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yo-yoify

NPM version build status build status Downloads js-standard-style

Transform choo, yo-yo, or bel template strings into pure and fast document calls.

install

npm install yo-yoify --save-dev

usage

When using Browserify, use as a global transform:

browserify entry.js -g yo-yoify -o bundle.js

how this works

yo-yo and bel, without this transform, pass template literals to hyperx. hyperx then parses and extracts the tags. bel then turns those tags into calls to document.createElement().

When using this transform, your template literals:

var msg = 'hello!'
var element = yo`<div>${msg}</div>`

Transform into direct calls to the document:

var msg = 'hello!'
var element = (function () {
  var bel0 = document.createElement("div")
  appendChild(bel0, [arguments[0]])
  return bel0
}(msg))

Which means, way better performance and compatibility with older browsers.

see also

  • babel-plugin-yo-yoify — yo-yoify as a Babel transform, works with any build setup that supports Babel

license

(c) 2016 Kyle Robinson Young. MIT License

About

Transform choo, yo-yo or bel template strings into pure and fast document calls

Resources

Stars

Watchers

Forks

Packages

No packages published