Class: Schienenzeppelin::AddOns::StimulusComponents

Inherits:
Schienenzeppelin::AddOn show all
Defined in:
lib/schienenzeppelin/addons/stimulus_components.rb

Instance Attribute Summary

Attributes inherited from Schienenzeppelin::AddOn

#context, #dependencies

Instance Method Summary collapse

Methods inherited from Schienenzeppelin::AddOn

apply, default_source_root, dependencies, get, identifier, #initialize

Constructor Details

This class inherits a constructor from Schienenzeppelin::AddOn

Instance Method Details

#applyObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/schienenzeppelin/addons/stimulus_components.rb', line 8

def apply
  run('yarn add tailwindcss-stimulus-components')
  inject_into_file('app/javascript/packs/application.js') do
    "      import { Application } from \"stimulus\"\n      import { definitionsFromContext } from \"stimulus/webpack-helpers\"\n\n      const application = Application.start();\n      const context = require.context(\"controllers\", true, /.js$/);\n      application.load(definitionsFromContext(context));\n\n      import { Dropdown, Modal, Tabs, Popover, Toggle, Slideover } from \"tailwindcss-stimulus-components\"\n      application.register('dropdown', Dropdown)\n      application.register('modal', Modal)\n      application.register('tabs', Tabs)\n      application.register('popover', Popover)\n      application.register('toggle', Toggle)\n      application.register('slideover', Slideover)\n    JS\n  end\nend\n"