const autoprefixer = require(‘autoprefixer‘) const postcss = require(‘postcss‘) const fs = require(‘fs‘) const syntax = require(‘postcss-less‘); var sprites = require(‘postcss-sprites‘); var opts = { stylesheetPath: ‘./dist‘, spritePath: ‘./dist/images/‘ }; //给less加上webkit前缀 const lessText=fs.readFileSync(‘./app.less‘); postcss([ sprites(opts),autoprefixer]) .process(lessText, { syntax: syntax }) .then(result => { console.log(result) console.log(result.content); })
原文:https://www.cnblogs.com/caoke/p/11042797.html