-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the importmap setup, inspired by the excellent mission contro…
…l jobs gem
- Loading branch information
1 parent
0312587
commit 48de572
Showing
16 changed files
with
38 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails | ||
import "@hotwired/turbo-rails" | ||
import "@rails/request.js" | ||
import "controllers" | ||
import "helpers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Import and register all your controllers from the importmap under controllers/* | ||
|
||
import { application } from "controllers/application" | ||
|
||
// Eager load all controllers defined in the import map under controllers/**/*_controller | ||
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" | ||
eagerLoadControllersFrom("controllers", application) | ||
|
||
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!) | ||
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading" | ||
// lazyLoadControllersFrom("controllers", application) |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...t/controllers/sortable_tree_controller.js → ...d/controllers/sortable_tree_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "helpers/request_utility" |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
controllers_path = File.expand_path("../app/javascript/controllers", __dir__) | ||
pin_all_from controllers_path, to: 'controllers', under: 'controllers' | ||
pin "application-spree-backend", to: "spree/backend/application.js", preload: true | ||
pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true | ||
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true | ||
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true | ||
pin "@rails/request.js", to: "requestjs.js", preload: true | ||
pin "sortablejs", to: "https://ga.jspm.io/npm:sortablejs@1.15.2/modular/sortable.esm.js" | ||
|
||
pin 'request_utility', to: 'request_utility' | ||
pin_all_from Spree::Backend::Engine.root.join("app/javascript/spree/backend/controllers"), under: "controllers", to: "spree/backend/controllers" | ||
pin_all_from Spree::Backend::Engine.root.join("app/javascript/spree/backend/helpers"), under: "helpers", to: "spree/backend/helpers" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters