Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dpogue/html2js-bin

Command-line HTML inlining tool
https://github.com/dpogue/html2js-bin

Last synced: 13 days ago
JSON representation

Command-line HTML inlining tool

Awesome Lists containing this project

README

        

html2js-bin
===========

A node-based command-line HTML inlining tool.

```
npm install html2js-bin
```

Usage
-----

```
html2js [options]
```

In no input file is specified, `html2js` will read from stdin.

### Options

* **output**: Optional output file, default to stdout
* **template**: A template file for wrapping the output
* **pattern**: A pattern to replace in the template file

You can run `html2js --help` for a full listing of options.

### Example

Given `index.html`

```html


Hello World


Hello World


Hello World


```

Running

```
html2js index.html
```

Output:

```javascript
'\n' +
'\n' +
' \n' +
' Hello World\n' +
' \n' +
' \n' +
'

Hello World

\n' +
'

Hello World

\n' +
' \n' +
''
```

### Template Example

Given `template.js`

```javascript
define(function() {
return
});
```

Running

```
html2js -t template.js -p '' index.html
```

Output:

```javascript
define(function() {
return '\n' +
'\n' +
' \n' +
' Hello World\n' +
' \n' +
' \n' +
'

Hello World

\n' +
'

Hello World

\n' +
' \n' +
''
});
```

Contributing
------------

Contributions of bug reports, feature requests, and pull requests are greatly appreciated!

Please note that this project is released with a [Contributor Code of Conduct](https://github.com/dpogue/html2js-bin/blob/master/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.

Licence
-------

Copyright © 2016 Darryl Pogue
Licensed under the MIT Licence.