# posthtml-collect-styles

> Collect styles from html and put it in the head

Latest version **0.0.1** (published 2016-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install posthtml-collect-styles
pnpm add posthtml-collect-styles
yarn add posthtml-collect-styles
bun add posthtml-collect-styles
```

## 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.0.1 |
| Published | 2016-05-24 |
| First published | 2016-05-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Aleksandr Yakunichev |
| Maintainers | canvaskisa |
| Keywords | posthtml, parser, transform, html, module, css, style, styles, collect, merge |

## Links

- npm: https://www.npmjs.com/package/posthtml-collect-styles
- Repository: https://github.com/canvaskisa/posthtml-collect-styles
- Issues: https://github.com/canvaskisa/posthtml-collect-styles/issues
- npm.io page: https://npm.io/package/posthtml-collect-styles

## Dependencies (1)

- [posthtml-match-helper](https://npm.io/package/posthtml-match-helper.md) ^1.0.1

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2016-05-24
- 0.0.0 — 2016-05-24

## README

# Posthtml-collect-styles <img align="right" width="220" height="200" title="PostHTML logo" src="http://posthtml.github.io/posthtml/logo.svg">

[![NPM version](http://img.shields.io/npm/v/posthtml-collect-styles.svg)](https://www.npmjs.org/package/posthtml-collect-styles)
[![Travis Build Status](https://travis-ci.org/canvaskisa/posthtml-collect-styles.svg)](https://travis-ci.org/canvaskisa/posthtml-collect-styles)
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)

## Installation
```console
$ npm i --save posthtml-collect-styles
```

## Usage
```html
<!-- index.html -->
<html>
<head>
</head>
<body>
  <style>.red {color: red;}</style>
  <style>.white {color: white;}</style>
</body>
</html>
```

```js
/* index.js */
var fs = require('fs');
var posthtml = require('posthtml');

posthtml()
  .use(require('posthtml-collect-styles')('style'))
  .process(fs.readFileSync('index.html', 'utf8'))
  .then(function(result) {
    return result; 

    /**
     * <html>
     *  <head>
     *    <style>
     *      .red {color: red;}
     *      .white {color: white;}
     *    </style>
     *  </head>
     *  <body></body>
     * </html>
     */
  });
```
## Api
`selector: string`: Selector to append styles, passed to [posthtml-match-helper](https://github.com/rasmusfl0e/posthtml-match-helper). `default: 'head'`.

## License
MIT © [Aleksandr Yakunichev](https://github.com/canvaskisa)

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