Skip to content

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

@michaelpb

Description

@michaelpb

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions