# posthtml-script-to-file

> posthtml style-to-file plugin

Latest version **0.1.1** (published 2017-04-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install posthtml-script-to-file
pnpm add posthtml-script-to-file
yarn add posthtml-script-to-file
bun add posthtml-script-to-file
```

## 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.1 |
| Published | 2017-04-30 |
| First published | 2017-04-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | kserks |
| Maintainers | kserks |
| Keywords | html, xml, css, file, javascript, convert, script-to-file, postproccessor, parser, transform, manipulation |

## Links

- npm: https://www.npmjs.com/package/posthtml-script-to-file
- Repository: https://github.com/posthtml/posthtml-script-to-file
- Homepage: https://github.com/vnjson/posthtml-script-to-file#readme
- Issues: https://github.com/posthtml/posthtml-script-to-file/issues
- npm.io page: https://npm.io/package/posthtml-script-to-file

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2017-04-30

## README

[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Tests][travis]][travis-url]
[![Coverage][cover]][cover-url]

# posthtml-script-to-file

## Install
```bash
npm i -D posthtml-script-to-file
```

## Usage


### Example

```js
const posthtml = require('posthtml')
const scriptToFile = require('posthtml-script-to-file')

const html = readFileSync('path/to/html', 'utf8')

posthtml([ scriptToFile({ path: './dist/index.js' }) ])
    .process(html)
    .then((result) => console.log(result.html))
```

__`index.html`__

```html
<html>
<head>
    <title>Wow</title>
    
</head>
<body style="background: #fff;">
  <h3> vnjson  </h3>
  <h4>javascript visual novel engine</h4>
  <script type="text/javascript">
    vnjs.on('preload', function(){
        return ['background.png'];
    });
  </script>
  <script type="text/javascript">
    vnjs.on('load', function(screen){
        let { parse, next } = this;
          
          parse({
              'scene': 'background',
              'screen': screen
            });
          next();
    });
  </script>
</body>
</html>
```

__`index.js`__

```javascript

vnjs.on('preload', function(){
        return ['background.png'];
});

vnjs.on('load', function(screen){
        let { parse, next } = this;
          
          parse({
              'scene': 'background',
              'screen': screen
            });
          next();
});

```

## LICENSE 

> MIT License (MIT)

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