Fork自 GitCode / 1024程序员开源挑战赛(10.23-11.14)
import prettier from "prettier/standalone"; import parserCss from "prettier/parser-postcss"; export const beautify = (code, option = {}) => { return prettier.format(code, { plugins: [parserCss], parser: "less", tabWidth: "tab" in option ? option.tab : 4 }); } export default { beautify }