# html-templates

> Simple tool to define and reuse snippets of HTML in other files.

Latest version **1.0.0** (published 2018-07-29) · 0 weekly downloads

## Install

```sh
npm install html-templates
pnpm add html-templates
yarn add html-templates
bun add html-templates
```

Provides the commands `hcc`, `hcc-server`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-07-29 |
| First published | 2018-07-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 (+3 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | imdaveead |

## Links

- npm: https://www.npmjs.com/package/html-templates
- npm.io page: https://npm.io/package/html-templates

## Dependencies (6)

- [ws](https://npm.io/package/ws.md) ^6.0.0
- [less](https://npm.io/package/less.md) ^3.8.0
- [sass](https://npm.io/package/sass.md) ^1.10.1
- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2
- [showdown](https://npm.io/package/showdown.md) ^1.8.6

## Recent versions

- 1.0.0 (latest) — 2018-07-29

## README

# HTML Templates
Simple tool to define and reuse snippets of HTML in other files.

`npm i html-templates -g`

## Examples

config.json
```json
{
    "source": "src",
    "templates": "src/templates",
    "output": "out"
}
```

src/templates/nav.html
```html
<nav class="navbar">
    <a href="/">Home</a>
    <a href="/usage">Usage</a>
    <a href="/examples">Examples</a>
    <a href="/about">About</a>
</nav>
```

Use it in some other page

src/index.html
```html
...
<body>
   {include "nav.html"}
   <h1>My Amazing Site</h1>
   ... 
</body>
...
```

You can now run `hcc` to "compile" your site and include
all the templates, which will appear in the output folder.

## All Special Tags

### {include "template.html"}
Inserts the contents of the file inside the templates folder
where you placed the include statement.

### {less "filename.less"}
Compiles the [LESS](http://lesscss.org/) file to `filename.css`
and places a css `<link>` tag where you placed the less
statement.

### {sass "filename.less"}
Compiles the [sass](https://sass-lang.com/) file to `filename.css`
and places a css `<link>` tag where you placed the less
statement.

### {markdown "filename.md"}
Compiles the markdown file and places the contents where you placed
the markdown statement.

## Live Development Server
Type `hcc-server` to start a localhost server on port 8080,
where the site will be live updated when you save a source file.

## Planned Features
- TypeScript Compiling
- Better Error Messages
- Template Variables/Inputs
- Webpack integration

---
_Source: https://npm.io/package/html-templates · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
