UNPKG

postcss-critical-split

Version:

A PostCSS plugin that takes existing CSS files and splits out the annotated critical styles into a seperate file.

19 lines (14 loc) 428 B
var postcss = require('postcss'), fs = require('fs'); module.exports = function(criticalSplit, input, output, opts) { spyOn(console, 'warn').and.callFake(function(message){ // do nothing }); spyOn(fs, 'writeFileSync').and.callFake(function(path, data) { return true; }); return postcss([criticalSplit(opts)]).process(input) .then( function(result) { expect(fs.writeFileSync).toHaveBeenCalledTimes(2); }); }