Socket
Socket
Sign inDemoInstall

simple-html-templates

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-html-templates

Simple nodejs html template compiler. Provides "include .html" function and standard es6 variable templates. 0 dependencies.


Version published
Maintainers
1
Created
Source

simple-html-templates

This is simple html template compiler. It provides "include .html" function and standard es6 variable templates. It has 0 dependencies.

Installation

npm i simple-html-templates

Cli usage

Process directory

sht-cli src_die dst_dir [recursive]

or single file

sht-cli ./src/index.html ./pub/index.html

Template usage

function include(relative_file_path)

...

<div class="body">${include('../modules/body.html')}</div>
...

"include" works with paths like standard "require" function.

variables

You can use standard es6 templates to get variable value, and "set" function to set global variable.

// defite test variable inline
${set('test', 'world')}
<p>Hello ${test}</p>

Also you can use "get" function.

// defite test variable inline
${set('test', 'world')}
<p>Hello ${get('test')}</p>

Examples

You can find more examples here: https://gitlab.com/hololoev/simple-html-templates/tree/master/examples

Integrating to package.json

"scripts": {
  "build": "sht-cli ./src ./pub recursive"
},

Keywords

FAQs

Package last updated on 24 Aug 2019

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