
克罗弗·贝克利
通过 Croffle CLI 将您的代码转换为其它框架代码
安装
$ npm install croffle @croffle/bakery
@croffle/bakery 是一个 Croffle CLI 模块.
设置 croffle.config.js
- 如果您的文件名称为格式
{dir}/{name}{ext},然后默认的 dist App 路径是./{type}/{name}/App{ext}基于您文件所在的路径. - 您的子文件( 组件) 是
{dir}/{name}{ext}基于您的 App 路径.
如果华夫饼没有返回值,则不创建文件.
一项投入可以实现多种产出.
// @ts-check
import {
ReactCroissant,
VueWaffle,
} from "croffle";
/**
* @type {import("@croffle/bakery").CroffleConfig[]}
*/
const config = [
{
targets: "src/apps/**.tsx",
croissant: ReactCroissant,
waffle: [
VueWaffle,
new VueWaffle(),
() => new VueWaffle({ useVue2: true }),
(defrosted, target) => {
const waffle = new VueWaffle();
return {
dist: `./{type}/{base}/App{ext}`,
waffle,
};
},
],
},
];
module.exports = config;
运行脚本
$ bake
$ npx @croffle/bakery bake