postcss([autoprefixer]).process(result.css, { from: src }).then(res => { res.warnings().forEach(warn => { console.warn(warn.toString())
from: file.relative, to: file.relative }, opts)).then(function (result) { file.contents = new Buffer(result.css); optimizedSize = file.contents.length;
function css(file) { postcss() .process(fs.readFileSync(file, 'utf8')) .then(function(result) { fs.writeFileSync('public/bundle.css', result.css) }) }
[ // Test with recent browsers ['last 2 version'], // Test with recent browsers + iOS 8 ['last 2 version', 'iOS >= 8'], // Test with recent browsers by usage, plus iOS 8, no IE. // I discovered that 'not ie' is not allowed. You must set a version. // To disable IE entirely, use 'not ie >= 1' ['last 2 version', 'iOS >= 8', 'not ie >= 1'], // I discovered that disabling IE doesn't disable IE mobile. // To disable IE mobile, I added an extra query. ['last 2 version', 'iOS >= 8', 'not ie >= 1', 'not ie_mob >= 1'], ].forEach(function(query) { var plugin = autoprefixer({ browsers: query }); postcss([ plugin ]).process(css).then(function (result) { result.warnings().forEach(function (warn) { console.warn(warn.toString()); }); console.log(query); console.log(result.css); console.log('\n'); }); });
makeFile(file) { return new Promise((resolve, reject) => { const srcPath = `${this.srcPath}/${file}.css`; const destPath = `${this.buildPath}/${file}.css`; const input = fs.readFileSync(srcPath, 'utf8'); console.log(colors.yellow(` Bundling CSS file: ${srcPath}`)); postcss() //.use(stylelint) .use(cssimport) .use(cssnext) .use(reporter({ clearMessages: true })) .process(input, { from: srcPath, to: destPath, }) .then((result) => { let text = result.css; if (this.isProduction) { text = new CleanCSS().minify(result.css).styles; } fs.writeFileSync(destPath, text); console.log(colors.green(` CSS bundle created: ${destPath}`)); resolve(); }) .catch((e) => { reject(e); }); }); }
function ha(a, b, c, e) { let g = j(a), h = N.source_map.enable && N.source_map.css, i = `${b}.map`; B.render({ file: a, indentedSyntax: c, outputStyle: 'compressed', outFile: b, sourceMap: h ? i : void 0 }, (a, c) => a ? ( console.error(` error: sass compile ${g}`.red, '\n', a), e()) : void f(C ? [C] : []).process(c.css, { from: g, to: j(b), map: h ? { inline: !1, prev: JSON.parse(c.map.toString()) } : void 0 }). then((a) => { let c = a.warnings(); 0 < c.length && ( console.log(`warn: auto prefixer ${g}`.yellow.bold), c.forEach((a) => console.log(` ${a.toString()}`.yellow))), q(b, a.css), h && d.writeFileSync(i, JSON.stringify(a.map, null, '\t')), e(); }).catch((a) => { r(`auto prefixer ${g}`, a), e(); })); }