kiso 0.2.0.pre → 0.2.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a28e88755cea2967813e27293413e587cef78cd5466240e16034df5c512b887d
4
- data.tar.gz: 6f8cee28fae6476f598f384ef4898726499f39e0ed99e4a785f64ef08f517205
3
+ metadata.gz: fc81659a56fbdc6091f37b314d096fa6eeca6a430284f594a2666e7646b49bed
4
+ data.tar.gz: 75d5f93f6d15684a044b340c1159fca84d0ac8285e16bf859c6805ceef35da4a
5
5
  SHA512:
6
- metadata.gz: 3caa5d60dd0339c04dfd2c7cd03695dcac54d9c9c91fe6b082b9fb6adc79bca73a8e7d9c0de9c91d50bba095f1dd738032d2be04cc77b558ba6ba9e45144e7d9
7
- data.tar.gz: 97b58647c61a6460cb72a9633bef14037026fd7c1be9d22b073e98f3de7c28d830b8f24f1fc628bc145d91b996954f7d7c22f49cc7a54ac9c35e420b3c877f1f
6
+ metadata.gz: 452f1fcafc008d9257fe03b6530a182e4be66a8fbcf7e42ae6d03131cc0fb3fe8f8f144330a6c667d7e9fbb4dad65a592dd17e24c1833fb28cfbd71c5e4224fc
7
+ data.tar.gz: cae0cecec57517234b7f5c02d44cfe7b3542b463bec938ae955793c345345be7daf63a7212adfd040cf1849ec2d5faeaa377e410b79c477abfe68e6a92110699
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.1.pre] - 2026-03-03
11
+
12
+ ### Fixed
13
+
14
+ - Propshaft `stylesheet_link_tag :app` compatibility — the Rails 8.1 default `:app` symbol caused Propshaft to serve `tailwindcss-rails` engine CSS stubs directly to the browser, resulting in 404 errors for absolute filesystem paths. Kiso now filters these build-time intermediates from Propshaft's stylesheet resolution automatically. Host apps using either `:app` or explicit `"tailwind"` work correctly.
15
+
10
16
  ## [0.2.0.pre] - 2026-03-03
11
17
 
12
18
  ### Added
@@ -55,7 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55
61
  - Lookbook component previews
56
62
  - Bridgetown documentation site
57
63
 
58
- [Unreleased]: https://github.com/steveclarke/kiso/compare/v0.2.0.pre...HEAD
64
+ [Unreleased]: https://github.com/steveclarke/kiso/compare/v0.2.1.pre...HEAD
65
+ [0.2.1.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.2.1.pre
59
66
  [0.2.0.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.2.0.pre
60
67
  [0.1.1.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.1.1.pre
61
68
  [0.1.0.pre]: https://github.com/steveclarke/kiso/releases/tag/v0.1.0.pre
data/lib/kiso/engine.rb CHANGED
@@ -51,6 +51,51 @@ module Kiso
51
51
  end
52
52
  end
53
53
 
54
+ # Filters tailwindcss-rails engine CSS stubs from Propshaft's :app stylesheet
55
+ # resolution so they are never served to the browser.
56
+ #
57
+ # Background: tailwindcss-rails generates intermediate stub files in the host
58
+ # app at app/assets/builds/tailwind/<engine_name>.css. Each stub contains a
59
+ # single @import with an absolute filesystem path:
60
+ #
61
+ # @import "/path/to/gems/kiso-0.2.0/app/assets/tailwind/kiso/engine.css";
62
+ #
63
+ # The Tailwind CLI resolves this @import at build time and inlines the engine
64
+ # CSS into the compiled output (app/assets/builds/tailwind.css). The stubs are
65
+ # build-time intermediates — they should never reach the browser.
66
+ #
67
+ # The problem: Propshaft's stylesheet_link_tag :app (the Rails 8.1 default)
68
+ # globs app/assets/**/*.css and generates a <link> tag for every match. This
69
+ # picks up the stubs alongside the compiled tailwind.css. The browser then
70
+ # receives a stub, encounters the @import with a filesystem path, interprets
71
+ # it as a URL, and gets a 404.
72
+ #
73
+ # Propshaft's excluded_paths config only removes top-level directories from
74
+ # the load path — it can't exclude files within a load path directory. The
75
+ # stubs live inside app/assets/builds/ (a single load path entry), so
76
+ # excluded_paths can't help.
77
+ #
78
+ # This fix prepends a filter onto Propshaft::Helper#app_stylesheets_paths to
79
+ # reject any asset whose logical path starts with "tailwind/" — these are
80
+ # always engine stubs generated by tailwindcss-rails, never user CSS.
81
+ # The compiled output is "tailwind.css" (no slash), so it passes through.
82
+ #
83
+ # This affects ALL engine stubs, not just Kiso's, because the problem is
84
+ # systemic to how tailwindcss-rails engine bundling interacts with Propshaft's
85
+ # :app resolution.
86
+ #
87
+ # See: propshaft-1.3.1 lib/propshaft/helper.rb#app_stylesheets_paths
88
+ # See: tailwindcss-rails lib/tailwindcss/engines.rb (stub generation)
89
+ # See: tailwindcss-rails lib/tailwindcss/engine.rb (excludes app/assets/tailwind
90
+ # but not app/assets/builds/tailwind)
91
+ initializer "kiso.filter_tailwind_stubs" do
92
+ ActiveSupport.on_load(:action_view) do
93
+ if defined?(Propshaft::Helper)
94
+ Propshaft::Helper.prepend(Kiso::PropshaftTailwindStubFilter)
95
+ end
96
+ end
97
+ end
98
+
54
99
  # Registers Kiso's component previews with Lookbook when available.
55
100
  initializer "kiso.lookbook", after: :load_config_initializers do
56
101
  if defined?(Lookbook)
@@ -0,0 +1,13 @@
1
+ module Kiso
2
+ # Filters tailwindcss-rails engine CSS stubs from Propshaft's :app stylesheet
3
+ # resolution. Prepended onto Propshaft::Helper by the engine initializer.
4
+ #
5
+ # Engine stubs have logical paths like "tailwind/kiso.css" — always under the
6
+ # "tailwind/" prefix. The compiled output is "tailwind.css" (no slash) and
7
+ # passes through unaffected.
8
+ module PropshaftTailwindStubFilter
9
+ def app_stylesheets_paths
10
+ super.reject { |path| path.start_with?("tailwind/") }
11
+ end
12
+ end
13
+ end
data/lib/kiso/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Kiso
4
4
  # @return [String] the current gem version
5
- VERSION = "0.2.0.pre"
5
+ VERSION = "0.2.1.pre"
6
6
  end
data/lib/kiso.rb CHANGED
@@ -5,6 +5,7 @@ require "tailwind_merge"
5
5
  require "kiso/version"
6
6
  require "kiso/configuration"
7
7
  require "kiso/theme_overrides"
8
+ require "kiso/propshaft_tailwind_stub_filter"
8
9
  require "kiso/engine"
9
10
  require "kiso/themes/shared"
10
11
  require "kiso/themes/badge"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre
4
+ version: 0.2.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Clarke
@@ -268,6 +268,7 @@ files:
268
268
  - lib/kiso/cli/make.rb
269
269
  - lib/kiso/configuration.rb
270
270
  - lib/kiso/engine.rb
271
+ - lib/kiso/propshaft_tailwind_stub_filter.rb
271
272
  - lib/kiso/theme_overrides.rb
272
273
  - lib/kiso/themes/alert.rb
273
274
  - lib/kiso/themes/avatar.rb