This repository has been archived by the owner on Jun 3, 2022. It is now read-only.
forked from jwhitley/requirejs-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bootstrapper.js and requirejs_run_config_json helper
This allows us to cache the runtime configuration instead of duplicating it on every page. You can also override bootstrapper.js to add other essential resources to be downloaded with require.js and the configuration. Bandwidth during the early stages of page loading can be better optimized by loading some scripts synchronously because the browser can start loading these resources earlier before all images and other scripts start loading. Because bandwidth isn't saturated early on, stuff like an image lazyloader would be good to load in bootstrapper.js.
- Loading branch information
1 parent
ee66558
commit 0dfd7e4
Showing
4 changed files
with
41 additions
and
36 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
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,4 @@ | ||
/* Copy and override this file to include other essential depenencies with require.js so they get cached | ||
*= require requirejs-config | ||
*= require require | ||
*/ |
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,3 @@ | ||
<%# Allows us to use a helper method from the requirejs-rails gem from within the asset pipeline %> | ||
<% environment.context_class.instance_eval { include RequirejsHelper } %> | ||
var require = <%= requirejs_run_config_json %>; |