atfcss

1.0.0 • Public • Published

atfcss

Insert critical css into the first <style> tag of an html file.

example

// atfcss.js

var atfcss = require('atfcss')
var path = require('path')

process.stdin
  .pipe(atfcss(path.resolve(__dirname, process.argv[2])))
  .pipe(process.stdout)

process.stdout.on('error', function () {})
$ cat critical.css | node atfcss.js source.html > final.html

methods

var atfcss = require('atfcss')

var stream = atfcss(htmlPath)

Return a transform stream. Pipe a CSS stream into stream and get back a version of the HTML file at htmlPath with the CSS inserted into its first <style> tag.

usage

This package also comes with a atfcss command:

usage: atfcss [html file] {OPTIONS}
 
  -i, --infile   Read input from a CSS file. Default: "-" (stdin) 
  -o, --outfile  Write output to a HTML file. Default: "-" (stdout)
  -h, --help     Show this message.

install

With npm do:

npm install atfcss

Or to get the command, do:

npm install atfcss -g

license

MIT

Package Sidebar

Install

npm i atfcss

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • crowl