我有个文件,姑且叫a.js吧,本地环境:nodejs pnpm yarn npm ,我想运行起来,用啥命令?
类似package.json里面的script来执行,如下所示:
"scripts": {
"dev": "next dev",
"build": "next build"
}
a.js
import fs from "fs";
import { extractStyle } from "@ant-design/static-style-extract";
// import withTheme from "../theme";
const outputPath = "/public/antd.min.css";
// 1. default theme
// const css = extractStyle();
// 2. With custom theme
const css = extractStyle();
fs.writeFileSync(outputPath, css);
console.log(`🎉 Antd CSS generated at ${outputPath}`);
这个文件在桌面, 在该文件的文件夹下打开cmd ,
node 文件名.js
就可以了