stimulus-rails 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 294b1fb5168db9b241b1a7f5e05d9bbcea2dc384c55ca0b2b1cef1731ec71c1e
4
- data.tar.gz: 1f29da6aa09938993859dc7c362509d9bc3b2cab1fd7259dda9a1c2fde9eb7ab
3
+ metadata.gz: d7b182fb2a48a9405b734b3d8180930f181cf115cb52b7d9061f3f92183d2f3e
4
+ data.tar.gz: 663e24b437761d3ff60ad7e78e8dc9ac9191ad91b83935ae95a04100dd6c66c2
5
5
  SHA512:
6
- metadata.gz: 78242453a57877148c68f4250cc8eb9a29f10e064512aee668c56a2b4f8ab71eb8448ae4a62e30af075f559469166b6da91df143ac46ba06a2e5a1af0facbb5c
7
- data.tar.gz: 004f62719a205a64f1f76d44501960100583e3af56c8f9c32a1a6f71aca4c23a5b39d3a8d0c898d77761c609032feb81c463ee3766ac633ba04690d96c8e7780
6
+ metadata.gz: 0d84fd49c9ad55572e525b5239b289fbe9a01839f67a24453efa875357ab0a0ecb30f39bc43df447d565dd75cda282ab21c653e09ff7db36d1150136b53fcbb0
7
+ data.tar.gz: 9e3bfa7a5be5a8457a3612863d7b136fd3c3e514f04367ceacce7327050f2403b69f18305c598cc07311a89cb3fa55c1f4aeb667c0f73e0c76cc15bdc8e684c7
@@ -1,8 +1,8 @@
1
1
  module Stimulus::StimulusHelper
2
- def stimulus_include_tags
2
+ def stimulus_include_tags(importmap = "importmap.json")
3
3
  safe_join [
4
4
  javascript_include_tag("stimulus/libraries/es-module-shims", type: "module"),
5
- tag.script(type: "importmap-shim", src: asset_path("importmap.json")),
5
+ tag.script(type: "importmap-shim", src: asset_path(importmap)),
6
6
  javascript_include_tag("stimulus/libraries/stimulus", type: "module-shim"),
7
7
  javascript_include_tag("stimulus/loaders/autoloader", type: "module-shim")
8
8
  ], "\n"
@@ -1,9 +1,9 @@
1
1
  // Load all the controllers within this directory and all subdirectories.
2
- // Controller files must be named *_controller.js.
2
+ // Controller files must be named *_controller.js or *_controller.ts.
3
3
 
4
4
  import { Application } from "stimulus"
5
5
  import { definitionsFromContext } from "stimulus/webpack-helpers"
6
6
 
7
7
  const application = Application.start()
8
- const context = require.context("controllers", true, /_controller\.js$/)
8
+ const context = require.context("controllers", true, /_controller\.(js|ts)$/)
9
9
  application.load(definitionsFromContext(context))
@@ -5,7 +5,9 @@ module Stimulus
5
5
  config.autoload_once_paths = %w( #{root}/app/helpers )
6
6
 
7
7
  initializer "stimulus.assets" do
8
- Rails.application.config.assets.precompile += %w( importmap.json stimulus/manifest )
8
+ if Rails.application.config.respond_to?(:assets)
9
+ Rails.application.config.assets.precompile += %w( importmap.json stimulus/manifest )
10
+ end
9
11
  end
10
12
 
11
13
  initializer "stimulus.helpers" do
@@ -13,8 +15,10 @@ module Stimulus
13
15
  helper Stimulus::StimulusHelper
14
16
  end
15
17
 
16
- Rails.application.config.assets.configure do |env|
17
- env.context_class.class_eval { include Stimulus::ImportmapHelper }
18
+ if Rails.application.config.respond_to?(:assets)
19
+ Rails.application.config.assets.configure do |env|
20
+ env.context_class.class_eval { include Stimulus::ImportmapHelper }
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Stimulus
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stephenson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-02-04 00:00:00.000000000 Z
13
+ date: 2021-06-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
- rubygems_version: 3.1.2
77
+ rubygems_version: 3.1.4
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: A modest JavaScript framework for the HTML you already have.