https://github.com/yacodes/posthtml-collect-styles
Move all styles tags' content to the head element
https://github.com/yacodes/posthtml-collect-styles
Last synced: about 2 months ago
JSON representation
Move all styles tags' content to the head element
- Host: GitHub
- URL: https://github.com/yacodes/posthtml-collect-styles
- Owner: yacodes
- License: mit
- Created: 2016-05-24T13:58:11.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-05-24T14:12:10.000Z (almost 9 years ago)
- Last Synced: 2025-02-14T00:37:12.490Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Posthtml-collect-styles
[](https://www.npmjs.org/package/posthtml-collect-styles)
[](https://travis-ci.org/canvaskisa/posthtml-collect-styles)
[](https://github.com/sindresorhus/xo)## Installation
```console
$ npm i --save posthtml-collect-styles
```## Usage
```html.red {color: red;}
.white {color: white;}```
```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;/**
*
*
*
* .red {color: red;}
* .white {color: white;}
*
*
*
*
*/
});
```
## 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)