Sha256: 39fcc89f9b490fce2a895b52eec5f3f15b76288fbe370c6a92eec79f83a6524e

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Schienenzeppelin
  module Helpers
    class StimulusComponents < HelperBase
      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

1 entries across 1 versions & 1 rubygems

Version Path
schienenzeppelin-0.1 lib/schienenzeppelin/helpers/stimulus_components.rb