Socket
Socket
Sign inDemoInstall

posthtml-collect-styles

Package Overview
Dependencies
11
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    posthtml-collect-styles

Collect styles from html and put it in the head


Version published
Weekly downloads
19
decreased by-29.63%
Maintainers
1
Install size
9.48 kB
Created
Weekly downloads
 

Readme

Source

Posthtml-collect-styles

NPM version Travis Build Status XO code style

Installation

$ npm i --save posthtml-collect-styles

Usage

<!-- index.html -->
<html>
<head>
</head>
<body>
  <style>.red {color: red;}</style>
  <style>.white {color: white;}</style>
</body>
</html>
/* 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. default: 'head'.

License

MIT © Aleksandr Yakunichev

Keywords

FAQs

Last updated on 24 May 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc