github.com/sbsoftware/crumble-stimulus

Seamless integration of stimulus.cr into crumble

1 stars
2 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  crumble-stimulus:
    github: sbsoftware/crumble-stimulus
    version: ~> 0.4.3

Then run:

shards install

shard.yml

Crystal
1.9.2
License
MIT
Author
Stefan Bilharz

Dependencies

Runtime Dependencies

  • js>= 1.8.0github: sbsoftware/js.cr
  • crumble>= 0.12.0github: sbsoftware/crumble
  • to_html>= 1.4.0github: sbsoftware/to_html.cr
  • stimulus*github: sbsoftware/stimulus.cr

README

crumble-stimulus

Seamless integration of stimulus.cr into crumble, providing a JS module that includes all your Stimulus::Controllers that is automatically added to your layout template.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      crumble-stimulus:
        github: sbsoftware/crumble-stimulus
  2. Run shards install

Usage

# make sure this comes before you require any controllers you want to include,
# otherwise they'll be missing
require "crumble-stimulus"
# or wherever your Stimulus controllers are
require "./stimulus_controllers/*"

The Crumble::StimulusControllers script is automatically added to any template inheriting from the generic ToHtml::Layout.

Custom Layout

If you don't use a layout based on ToHtml::Layout, you'll have to include the Crumble::StimulusControllers script manually:

html do
  head do
    # [...]
    Crumble::StimulusControllers
    # [...]
  end
end