hanami / cli

Hanami command line
MIT License
27 stars 27 forks source link

Add --template option to generators producing view templates #230

Open Atelier-Mirai opened 1 week ago

Atelier-Mirai commented 1 week ago

I like slim templates and would like to use them in HANAMI.

--template option

The FEATURES.md file contains the following.

### v0.8.0 - 2016-07-22
- CLI: `hanami new` can be used with `--template` argument to generate a new project with (`erb`/`haml`/`slim`) templates

I executed the following command.

$ hanami new bookshelf --template=slim
ERROR: "hanami new" was called with arguments "bookshelf --template=slim"

Is the --template option already obsolete?

generate slim template

The following command was executed to generate the action.

$ hanami generate action home.show

The app/templates/home/show.html.erb is created. How do I configure it to generate a show.html.slim instead of a show.html.erb?

Versions of Hanami are as follows.

$hanami --version
v2.2.0.beta1

Thank you very much for your time, and we appreciate your response.

timriley commented 1 week ago

Hi @Atelier-Mirai, thanks for your feedback!

The good news is that we already have first class support for Slim with the view layer we reintroduced in Hanami 2.1. Any *.html.slim template file will work :)

Unfortunately, our generators currently do not produce Slim templates. That --template=slim CHANGELOG entry you mentioned is from way back in Hanami 0.8.0, which is many years ago. That flag was lost when we reintroduced the view layer in 2.1.

If you'd like to open PRs bringing this flag back, I'd be very happy to review and accept them. Please also include Haml support, which is our other officially supported template engine :)

Atelier-Mirai commented 1 week ago

Thank you for your guidance.

I can now use slim templates by writing gem “slim” in the Gemfile.

As a newbie, I do not have the ability to issue a PR and have manually changed from erb to slim. (I just finished the tutorial on BookShelf).

I would like to donate $1 as a thank you, is it possible, I am looking forward to the completion of 2.2.0.