posthtml-collect-styles

0.0.1 • Public • Published

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

Package Sidebar

Install

npm i posthtml-collect-styles

Weekly Downloads

26

Version

0.0.1

License

MIT

Last publish

Collaborators

  • canvaskisa