File tree Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- CORE_THEMES = { "Horizon" => -1 }
3
+ Rails . application . config . after_initialize do |config |
4
+ if Rails . env . development?
5
+ require "listen"
4
6
5
- Rails . application . config . to_prepare do |config |
6
- CORE_THEMES . each do |theme_name , theme_id |
7
- RemoteTheme . import_theme_from_directory (
8
- "#{ Rails . root } /themes/#{ theme_name } " ,
9
- theme_id : theme_id ,
10
- )
11
- end
12
- if Rails . env == "development"
13
- Rails . application . config . watchable_dirs [ "themes" ] = %w[ rb scss css js gjs yml ]
7
+ listener =
8
+ Listen . to ( "#{ Rails . root } /themes" ) do
9
+ Rails . logger . info "Theme folder changed. Syncing..."
10
+ CoreThemesManager . sync!
11
+ end
12
+ listener . start
14
13
end
15
14
end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ CoreThemesManager . sync!
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ CORE_THEMES = { "Horizon" => -1 }
4
+ class CoreThemesManager
5
+ def self . sync!
6
+ CORE_THEMES . each do |theme_name , theme_id |
7
+ RemoteTheme . import_theme_from_directory (
8
+ "#{ Rails . root } /themes/#{ theme_name } " ,
9
+ theme_id : theme_id ,
10
+ )
11
+ end
12
+ end
13
+ end
You can’t perform that action at this time.
0 commit comments