# makestatic-dom-version

> Inject version information into HTML pages

Latest version **1.0.2** (published 2018-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install makestatic-dom-version
pnpm add makestatic-dom-version
yarn add makestatic-dom-version
bun add makestatic-dom-version
```

## 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.2 |
| Published | 2018-01-18 |
| First published | 2017-03-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | muji |
| Maintainers | tmpfs |
| Keywords | makestatic-plugin, dom, html, meta, version |

## Links

- npm: https://www.npmjs.com/package/makestatic-dom-version
- Repository: https://github.com/makestatic/compiler
- Homepage: https://makestatic.ws
- Issues: https://github.com/makestatic/compiler/issues
- npm.io page: https://npm.io/package/makestatic-dom-version

## Dependencies (1)

- [when](https://npm.io/package/when.md) ^3.7.8

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-01-18
- 1.0.1 — 2018-01-17
- 1.0.0 — 2017-03-08

## README

# DOM Version

> Inject version information into HTML pages

Writes version information to HTML pages using the version information created by the `build-version` plugin.

---

- [Install](#install)
- [API](#api)
  - [DomVersion](#domversion)
    - [See Also](#see-also)
    - [DomVersion](#domversion-1)
      - [Options](#options)
      - [Throws](#throws)
    - [.setVersionsMeta](#setversionsmeta)
    - [.sources](#sources)
- [License](#license)

---

## Install

```
yarn add makestatic-dom-version
```

## API

### DomVersion

Inject version information into HTML pages.

Use this plugin to generate meta elements containing version information or
add visible version information to HTML pages.

#### See Also

* [Build Version](https://makestatic.ws/docs/api/build-version/ "Build Version")
* [Parse HTML](https://makestatic.ws/docs/api/parse-html/ "Parse HTML")

#### DomVersion

```javascript
new DomVersion(context, options)
```

Inject version information into HTML pages.

Configure this plugin for the `transform` phase. Expects that the
`build-version` plugin has already generated version information and
that the HTML parser has been enabled for the `parse` phase.

For each matched HTML page with an abstract syntax tree call each
function in the `behaviours` option.

If no behaviours are specified this implementation will generate a meta
element for each entry in the `versions` map.

The signature for a `behaviour` function is:

```javascript
function behaviour(context, html, versions)
```

Where `context` is the processing context, `html` is the AST for the HTML
file currently being processed and `versions` is the map of version
information generated by the `build-version` plugin.

* `context` Object the processing context.
* `options` Object plugin options.

##### Options

* `behaviours` Array list of behaviour functions.

##### Throws

* `Error` if no versions information is available.

#### .setVersionsMeta

```javascript
DomVersion.prototype.setVersionsMeta(context, html, versions)
```

Default behaviour function that generates a `meta` element for each key
in the `versions` map.

The `name` attribute of each meta element is set to the key suffixed with
`-version` and the `content` is set to the version value for the key.

Such that `{package: '1.0.0'}` generates:

```html
meta(name="package-version" content="1.0.0")
```

* `context` Object the processing context.
* `html` Object the HTML document AST.
* `versions` Object list of project versions.

#### .sources

```javascript
DomVersion.prototype.sources(file, context, options)
```

For each matched file with an HTML AST call all the behaviour functions
associated with this plugin.

* `file` File the current file.
* `context` Object the processing context.
* `options` Object plugin options.

## License

MIT

---

Created by [mkdoc](https://github.com/mkdoc/mkdoc) on March 12, 2017

[docs]: https://makestatic.ws/docs/ "Documentation"
[standalone manual]: https://github.com/makestatic/website/blob/master/MANUAL.md "Standalone Manual"
[yarn]: https://yarnpkg.com "Yarn"
[webpack]: https://webpack.js.org "Webpack"
[babel]: https://babeljs.io "Babel"
[postcss]: http://postcss.org "Postcss"
[sugarss]: https://github.com/postcss/sugarss "Sugarss"
[reshape]: https://github.com/reshape/reshape "Reshape Source Code"
[reshapeml]: https://reshape.ml "Reshape"
[clean-css]: https://github.com/jakubpawlowicz/clean-css "Clean CSS"
[html-minifier]: https://github.com/kangax/html-minifier "Html Minifier"
[uglify-js]: https://github.com/mishoo/UglifyJS2 "Uglify JS"
[imagemin]: https://github.com/imagemin/imagemin "Imagemin"
[mkdoc]: https://github.com/mkdoc/mkdoc "Mkdoc"
[browsersync]: https://www.browsersync.io "Browsersync"
[yeoman]: http://yeoman.io "Yeoman"
[spike]: https://www.spike.cf "Spike"
[validator]: https://github.com/validator/validator "HTML Validator"
[github pages]: https://pages.github.com "Github Pages"
[amazon s3]: https://aws.amazon.com/s3/ "Amazon S3"
[google sitemaps]: https://support.google.com/webmasters/answer/183668?hl=en&ref_topic=4581190 "Google Sitemaps"
[sitemaps]: https://www.sitemaps.org/ "Sitemaps"

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