Skip to content

Latest commit

 

History

History
65 lines (42 loc) · 1.61 KB

generator.md

File metadata and controls

65 lines (42 loc) · 1.61 KB

Generator

Generate template from existing files

Syntax

scffld generate [...glob] [--basePath] [--replaceTokens]

Where glob is a space separated list of globby compatible globs.

basePath can be specified to ignore that in the final filename.

replaceTokens is a comma separated list of props that will be added to the template, with the value being replaced with the appropriate replacement directive. See Replace tokens example.

The resulting template is printed to output, to write to a file append > path/to/template.md

If a .gitignore is present it will respect it, also {basePath}.scffldignore

Examples

Grab everything in a directory

npx @scffld/cli generate ./src/ > templates/app.md

Only include specific filetypes in a subdirectory

npx @scffld/cli generate \
    ./src/components/**/*.{tsx,scss} */ \
    > templates/components.md

Base path

npx @scffld/cli generate ./src/components/ --basePath=src/components/ > templates/app.md

Given:

./src/components/Foo/Bar.tsx

Would output to:

{outputDirectory}Foo/Bar.tsx

Replace tokens

  • name & foo props will be added to the template params
  • All variants of My Generator Component && Foo Bar in file name & content will be replaced with the appropriate scffld directive
scffld generate ./generator-demo/components/ --basePath="generator-demo/" --replaceTokens="name:My Generator Component,foo:Foo Bar" > generator-demo.md

scffld generator-demo --outputDirectory=./demo-src/ --name="scffld Rocks" --foo="yolo"