UNPKG

postcss-critical-split

Version:

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

20 lines (15 loc) 463 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; }); expect(console.warn).not.toHaveBeenCalled(); return postcss([criticalSplit(opts)]).process(input) .then(function(result) { expect(console.warn).toHaveBeenCalled(); }); }