Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyperify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperify

Browserify transform for hyperHTML templates

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

hyperify

Build Status Standard - JavaScript Style Guide

Browserify transform for hyperHTML templates :zap:

Credit for the idea behind this module goes to @WebReflection for outlining a similar approach with https://github.com/WebReflection/viperHTML#handy-patterns. :+1:

Example

index.js

var hyperHTML = require('hyperhtml')
var template = require('./template.html')
var render = hyperHTML.bind(document.body)

template(render, {
  text: "Hello world!"
})

template.html

<div>
  ${data.text}
</div>

The template compiles down to effectively the following function:

function (render, data) {
  return render`<div>
    ${data.text}
  </div>`
}

Usage

Install hyperify via npm:

npm install hyperify -D

or yarn:

yarn add hyperify -D

Then add hyperify to your list of browserify transforms:

browserify -t hyperify index.js > bundle.js

Additionally you can configure hyperify via CLI as follows:

browserify -t [ hyperify -e '.hyper.html' -a render -a model ] index.js > bundle.js

Options

  • -e | --ext | --extension - Define which file extension to apply the transform to. Default: '.html'
  • -a | --args | --arguments - Define which arguments the template function should be called with. Default: ['render', 'data'] Note: the first arg should always be your render function.

License

MIT

Keywords

FAQs

Package last updated on 01 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc