1.0.0 • Published 11 years ago
atfcss v1.0.0
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.htmlmethods
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 atfcssOr to get the command, do:
npm install atfcss -glicense
MIT