/vite-plugin-cooklang

Primary LanguageTypeScriptMIT LicenseMIT

Vite Cooklang Loader

npm version npm downloads Github Actions

This plugin enables loading of Cooklang markup files.

Setup

Install this package

npm install --save-dev vite-plugin-cooklang
# OR
yarn add -D vite-plugin-cooklang

Update your config

Add the plugin to your Vite config as below:

// vite.config.js
import { defineConfig } from "vite";
import cooklang from "vite-plugin-cooklang";

export default defineConfig({
  plugins: [cooklang()],
});

Usage

Recipes are loaded using the Cooklang-TS library and have the below properties:

import recipe from "./test/example/recipes/Easy Pancakes.cook";

const {
  //
  ingredients,
  cookwares,
  metadata,
  steps,
  shoppingList,
} = recipe;

See the test project for an example of using this plugin.

TODO

  • Write a readme.
  • Test both inline Recipe class and JSON transformer approaches.
  • More tests!

Thanks