# gulp-html-to-ts

> Gulp task that converts a html file into a ts file containing an module with string template

Latest version **0.1.3** (published 2015-05-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-html-to-ts
pnpm add gulp-html-to-ts
yarn add gulp-html-to-ts
bun add gulp-html-to-ts
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2015-05-17 |
| First published | 2015-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Abraão Alves |
| Maintainers | abraaoalves |
| Keywords | html, typescript, javascript, ts, js, convert, inline, gulpplugin, gulpfriendly |

## Links

- npm: https://www.npmjs.com/package/gulp-html-to-ts
- Repository: https://github.com/AbraaoAlves/gulp-html-to-ts
- Issues: https://github.com/AbraaoAlves/gulp-html-to-ts/issues
- npm.io page: https://npm.io/package/gulp-html-to-ts

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) ^0.6.1
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.1.3 (latest) — 2015-05-17
- 0.1.2 — 2015-05-17
- 0.1.0 — 2015-05-17

## README

HTML template to TS
====================

This gulp plugin converts a html file with into a ts file containing an object with string template.

Writing template inside a structured HTML file is much more practical than in a one line javascript string.
Therefore this plugin turns a HTML file with templates into a js object.
You can use whatever template language you like it simply turns the html nodes into a js string.
It will take the html name file to named module and property `html` as string value.

Usage
-----
An example usage with gulp:
```javascript
var gulp        = require('gulp');
var html2ts = require('gulp-html2ts');

gulp.task('template', function() {
	return gulp.src( 'my/template.html' )
	.pipe( html2ts() )
	.pipe( gulp.dest( './' ) ); //generate my/template.html.ts
});

```

Example
-------

This example shows how this plugin turn html into a ts file.

*HTML Source* : `mytemplate.html`
```html
  <p>A {{ handlebar }} example.</p>
```

*The generated output* : `mytemplate.html.ts`
```typescript
module mytemplate { export var html = '<p>A {{ handlebar }} example.</p>';}
```

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