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

ohm-builder

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ohm-builder

Bring ohm to your browser the easy way

  • 0.4.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

Ohm-builder

Travis AppVeyor Codecov npm

Bring ohm to your browser the easy way.

What's Ohm? Check it out.

Installation

This requires Node v4+

$ npm install --save-dev ohm-builder

What's the deal with HTML?

Ohm has steps on defining your grammar for either the browser or node, but not both. Don't like having two sets of steps? Keep reading...

HTML's <script> tag only allows you to use the src= attribute if you're using a path to a javascript file, not an Ohm grammar. Let's fix that.

Now you can write your HTML with script tags like: <script type="text/ohm-js" src="src/bash.ohm"></script>. Run this tool and you can statically generate a new HTML file with the grammar included.

Why would I want this?

  • Write your grammar once, use it in both the browser or NodeJS.
  • Re-use someone else's ohm grammar as a simple npm dependency.
  • Develop your browser code following the recommended steps on the repo, instead of figuring out some messy way to load your grammar in at run-time.
  • Unit testing just got easier! Use NodeJS to run unit tests, even if you're developing for a project in the browser.
  • Edit your grammar without dealing with all of the fuss of HTML.

Ok, so how do I use this?

Try it out as an npm script:

// put this in package.json
"scripts": {
  // ...
  "build": "ohm-builder.js src/index.generator.html index.html"
},
$ # Make your edits in src/index.generator.html
$ # Then run this command to build index.html
$ npm run build

If you don't want to constantly reenter that command, check out watch to automatically recompile your project:

$ npm install --save-dev watch

Then, assuming your file is inside src/, put this in package.json:

"scripts": {
  // ...
  "build": "ohm-builder.js src/index.generator.html index.html",
  "build:watch": "watch 'npm run build' src"
},

Keywords

FAQs

Package last updated on 01 Jul 2016

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