Sha256: a860eb1bd278004e4a543e3d7cf55c7e9648bb8fc52077cf45b1c0e7695cbf3b

Contents?: true

Size: 1.15 KB

Versions: 53

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # Custom add-ons for RailsAppGenerator
  module AddOns
    # Stimulus components
    class StimulusComponents < RailsAppGenerator::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

53 entries across 53 versions & 1 rubygems

Version Path
rails_app_generator-0.3.6 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.5 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.4 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.3 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.2 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.1 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.3.0 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.43 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.42 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.41 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.40 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.39 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.38 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.37 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.36 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.35 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.34 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.33 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.32 lib/rails_app_generator/addons/stimulus_components.rb
rails_app_generator-0.2.31 lib/rails_app_generator/addons/stimulus_components.rb