Sha256: 589318c772ea3a2eb49124a7239f678301fe98f2a88f63335414539000aae0fa

Contents?: true

Size: 1.13 KB

Versions: 37

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # Custom add-ons for RailsAppGenerator
  module AddOns
    # Stimulus components
    class StimulusComponents < AddOn
      depends_on :stimulus

      def apply
        run('yarn add tailwindcss-stimulus-components')
        inject_into_file('app/javascript/packs/application.js') do
          <<~JS
            import { Application } from "stimulus"
            import { definitionsFromContext } from "stimulus/webpack-helpers"

            const application = Application.start();
            const context = require.context("controllers", true, /.js$/);
            application.load(definitionsFromContext(context));

            import { Dropdown, Modal, Tabs, Popover, Toggle, Slideover } from "tailwindcss-stimulus-components"
            application.register('dropdown', Dropdown)
            application.register('modal', Modal)
            application.register('tabs', Tabs)
            application.register('popover', Popover)
            application.register('toggle', Toggle)
            application.register('slideover', Slideover)
          JS
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
rails_app_generator-0.1.26 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.25 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.24 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.23 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.22 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.21 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.20 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.19 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.18 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.17 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.16 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.15 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.14 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.13 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.12 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.11 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.10 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.9 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.8 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.1.7 lib/rails_app_generator/addons/stimulus_components.rb