epandco / unthink-cli

A cli tool for creating projects in the unthink stack.
https://epandco.github.io/unthink-cli
MIT License
1 stars 1 forks source link

Add resource generator plugin #90

Open lxndrdagreat opened 4 years ago

lxndrdagreat commented 4 years ago

Command

unthink generate resource my-resource-name

Arguments

  1. Kebab-cased name for the resource. E.g., "hello-world"

Default Result

By default, the following file(s) will be created from template:

By default, the following file(s) will be modified:

Options

--view

Use --view to provide an alternate name for the nunjucks template

--no-view

Use --no-view to skip generation of a template file and the inclusion of the view(...) example in the routes.

--no-data

Use --no-data to skip the inclusion of the JSON data(...) endpoint in the routes.

--base-path

Use --base-path to set the basePath of the resource.

unthink generate resource hello-world --base-path="/"

--entry

Use --entry to have the nunjucks template include a reference to an entry bundle.

unthink g resource hello-world --entry=hello-world

Would add something like this to the template:

<script src="{{ PUBLIC_FILES_HOST }}/public/js/hello-world.bundle.js?v={{ APP_VERSION }}"></script>
lxndrdagreat commented 4 years ago

One reason I am pushing for this is because I would like to use it to generate the "hello-world" example included in the template, instead of having that code directly included in the template itself.