@cguevara/filejutsu

An experimental file generation tool inspired by Next.js.

Usage no npm install needed!

<script type="module">
  import cguevaraFilejutsu from 'https://cdn.skypack.dev/@cguevara/filejutsu';
</script>

README

Filejutsu

Filejutsu is an experimental tool for generating files and directory structures inspired by Next.js. Filejutsu can be used for various tasks such as:

  • Code generation
  • Static HTML/CSS/JS generation

How Filejutsu Works

The `template/` directory contains template files (files that end in `__.js`). Filejutsu converts these template files into actual files.

For example, a template file named `index.html__.js` will be converted into `index.html`.

Each template file is an ES module that exports the following functions:

  • `export default function(props) {...}` - The default export is a function that returns the file's contents.
  • `export async getProps(context) {...}` - (optional) `getProps` is an async function that returns the props, which will be passed to the default function.
  • `export async getPaths(context) {...}` - (optional) `getPaths` is an async function that returns the path parameters for dynamic filenames. TODO Explain this in more detail and include an example.