Skip to content

modulo cli mk2 / create-modulo template: Auto generating files and directory listings #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
michaelpb opened this issue Aug 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@michaelpb
Copy link
Contributor

Initial version (manual mode only):

  • Manual mode (does not run during npm build)

  • Just a collection of .js scripts which generate basic directory listings as JSON files into your src at expected locations

  • The create-modulo template

    • Will include a light index.js that imports Modulo in Node so scripts can use templating or modulo utilities as expected, and run as registered commands
    • Will include a one that regenerates "articles" as an example, and also
    • Will include documentation on how to regenerate OR edit with Decap (two options, since "manual" mode)
  • Include instructions on how to make automatic, if you want (basically include in npm build script)

Second version:

  • include helpers to make it automatic during development as well (e.g. watching for file changes, and outputting to a gen-build)

One approach that could be useful in the time being, esp. as a static file based replacement for directory listings:

  1. Add scripts to generate files, can be simple node js scripts in a "gen-scripts/" directory
  2. Add another directory, perhaps: gen-build/
  3. Conventionally, the scripts in gen-scripts/ should be run like node gen-scripts/index.js
  4. This gets overlayed with src/ during development / build (just like the current __dirlist system)
  5. Related: Add an example 404.html page

This will create json listings that are "defaults". It's also possible it'd be better these get generated into the same directory, e.g. src/ and gen-build/ be merged, so that DecapCMS plays well. Maybe two modes: "Manual mode" (default, scripts output to src), and "Auto-overlay mode" (uses gen-build)

@michaelpb michaelpb added the enhancement New feature or request label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant