Skip to content

Commit 42c78e3

Browse files
committed
Prioritize custom view templates
Current behavior: Custom templates are ignored by the tailwindcss-rails generator Expected behavior: View templates under "#{RAILS_ROOT}/lib/templates/erb/scaffold" should be prioritized by the generator. #164
1 parent 781d840 commit 42c78e3

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
## v2.0.23 / 2023-02-11
3+
4+
* Prioritize view templates under "#{RAILS_ROOT}/lib/templates/erb/scaffold" for the scaffold generator [#164](https://github.com/rails/tailwindcss-rails/issues/164).
5+
6+
27
## v2.0.22 / 2023-02-08
38

49
* Update to [Tailwind CSS v3.2.6](https://github.com/tailwindlabs/tailwindcss/releases/tag/v3.2.6) by [@flavorjones](https://github.com/flavorjones).

lib/generators/tailwindcss/scaffold/scaffold_generator.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ module Generators
66
class ScaffoldGenerator < Erb::Generators::ScaffoldGenerator
77
include Rails::Generators::ResourceHelpers
88

9-
source_root File.expand_path("../templates", __FILE__)
9+
def self.source_root
10+
custom_scaffold_templates_path = Rails.root.join("lib", "templates", "erb", "scaffold")
11+
return Dir.exist?(custom_scaffold_templates_path)? custom_scaffold_templates_path : File.expand_path("../templates", __FILE__)
12+
end
1013

1114
argument :attributes, type: :array, default: [], banner: "field:type field:type"
1215

lib/tailwindcss/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Tailwindcss
2-
VERSION = "2.0.22"
2+
VERSION = "2.0.23"
33
end

0 commit comments

Comments
 (0)