Code Monkey home page Code Monkey logo

h5x's Introduction

H5X - HTML Executable

H5X turns a regular HTML file into a shell script or tiny webapp with all the power of NodeJS.

Say what?

Just install:

npm i -g sbacic/h5x

And run it:

h5x -g cli && h5x cli.html

Need a server? Just run:

h5x -g server && h5x server.html

Attributes

You can change how h5x treats your html by setting attributes on your script tag. Here's a list:

  • server (boolean)

Whether to run in server or CLI mode. If set to true, a simple connect server is started before calling your code. You can access this server via the app variable. You can generate an example/blueprint by running h5x -g server.

  • browser (boolean)

Opens the html file in your preferred browser.

  • port(string)

A custom port for your tiny server. The default is set to 8000, so only change this if you have some other service already using that port.

  • dependencies (string)

A string listing all the dependencies you want to load. These dependencies are loaded before your code is run. Example: dependencies="marked,[email protected]".

How does it work?

H5x parses your HTML, looking for a script tag with a text/h5x type. Then it runs the code inside the tag. Only the first match is run, the rest are ignored.

Some help to get you started

H5x provides you with two variables to get you started: app for servers and cliargs for command line arguments passed to your function.

h5x's People

Contributors

sbacic avatar

Watchers

James Cloos avatar  avatar

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.