Socket
Socket
Sign inDemoInstall

simple-html-templates

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

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

Readme

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_dir 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

Last updated on 24 Aug 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc