Engine Rails com helpers e partials Tailwind reutilizáveis (Bullet Train / Rails).
- Helper TailwindUiHelpers#show_tabs
- Partials de atributos: toggle, pre, json, cents, workflow_state
- Partials de fields: toggle_field, cents_field
- Suporte para resolução de caminhos em
themes/attributesethemes/filoo/attributes(e equivalentes para fields)
- No Gemfile já existe:
gem "bullet_train-extensions", path: "../bullet_train-extensions"-
Rode
bundle installe reinicie o servidor. -
Use nas views normalmente, por exemplo:
<%= render "themes/attributes/toggle", object: @record, attribute: :active %>
<%= render "themes/fields/toggle_field", form: f, method: :active %>
<%= show_tabs({ "Aba 1" => "partial/path", "Aba 2" => { partial: "other/path", locals: { foo: 1 } } }) %>- Garanta que você tem uma conta no RubyGems e que
gem signinestá configurado. - Atualize a versão em
version.rb. - Gere o
.gem:
cd bullet_train-extensions
gem build bullet_train-extensions.gemspec- Faça o push:
gem push bullet_train-extensions-<versao>.gem- Em outros projetos, basta adicionar no Gemfile:
gem "bullet_train-extensions"ou usar via Git:
gem "bullet_train-extensions", github: "mcfox/bullet_train-extensions"- O engine não isola namespace para facilitar a resolução de partials.
- O helper é incluído automaticamente no ActionView.
- Se você tiver mais partials (ex.: json_field, workflow_state_field, etc.), adicione-os em
app/views/themes/...dentro do engine.
Não. O arquivo .gem é um artefato gerado e não deve ser commitado no repositório.
O fluxo recomendado é:
- Gere o .gem localmente apenas para testar/validar a gemspec (como no CI).
- Publique no RubyGems com
gem push(veja a seção acima). - Adicione
*.gemao.gitignore(já configurado neste repo) para evitar commits acidentais. - Se quiser disponibilizar binários/artefatos, use GitHub Releases, mas ainda assim não versione o
.gemno git.