hanami / hanami/hanami-cli

Make Template dir configurable, for easy templates overrides (UI engines extensions writing)

Open
#243 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
33
Forks
55
Avg merge
8d 7h
Merged PRs (30d)
2

Description

### Background

I'm writing a Bulma support extension for hanami-cli. To make it possible, I need to duplicate some commands, generators and templates, most of which are ruby files that I can safely ignore. This happens, because all our generators use `__dir__`, to fetch the source file to generate content from.

```ruby
def template(path, context)
require "erb"

ERB.new(
File.read(File.join(__dir__, "app", path)),
trim_mode: "-"
).result(context.ctx)
end
```

### TODO

Make the `__dir__` configurable, so gem authors can easly change the `base_path` for generators. If file does not exists, fall-back to default Hanami::CLI path.

### Pros

- Writing frontent engine support or file interpreters spport will be very easy (bulma, boostrap, or slim/haml, etc)
- We can minimize the number of files needed to be copied and kept in sync.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.