# y-html-2-js

> read the html block to js string variable

Latest version **0.3.0** (published 2014-04-10) · 0 weekly downloads

## Install

```sh
npm install y-html-2-js
pnpm add y-html-2-js
yarn add y-html-2-js
bun add y-html-2-js
```

## 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.3.0 |
| Published | 2014-04-10 |
| First published | 2013-09-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Yixi |
| Maintainers | yixi |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/y-html-2-js
- Repository: https://github.com/Yixi/grunt-YHtmlToJs
- Issues: https://github.com/Yixi/grunt-YHtmlToJs/issues
- npm.io page: https://npm.io/package/y-html-2-js

## Recent versions

- 0.3.0 (latest) — 2014-04-10
- 0.2.0 — 2013-09-29
- 0.1.0 — 2013-09-29

## README

# YReadHtmlToJs

> read the html block to js string variable

## Getting Started
This plugin requires Grunt `~0.4.1`

If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

```shell
npm install YReadHtmlToJs --save-dev
```

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

```js
grunt.loadNpmTasks('y-html-2-js');
```

## The "YReadHtmlToJs" task

### Overview
In your project's Gruntfile, add a section named `YReadHtmlToJs` to the data object passed into `grunt.initConfig()`.

```js
grunt.initConfig({
  YReadHtmlToJs: {
    options: {
      // Task-specific options go here.
    },
    your_target: {
      // Target-specific file lists and/or options go here.
    },
  },
})
```

### Options

#### options.url
Type: `String`
Default value: `''`

set the template HTML base location

#### options.separator
Type: `String`
Default value: `;\n`


### Usage Examples

In javascrpt:

``` 
var HTML_TEMPLATE = '<%= YHTJ:/template/item.html:note %>'
```
In `/template/item.html` file:

<pre>
<!--YHTJ:note-->
<div class="note">
	<div class="title">{title}</div>
</div>
<!--endYHTJ-->
</pre>

when run `y-html-2-js` task , will find the block `<%= YHTJ:xxxx:xx %>` of javascript file, then will find the `note` block of `/template/item.html` file.

so will build like this:

```
var HTML_TEMPLATE = '<div class="note"><div class="title">{title}</div></div>'
```



## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).

## Release History
_(Nothing yet)_

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