Move the scripts helper into a better place.
This commit is contained in:
parent
ec280913b2
commit
0d9e2b5df5
|
@ -1,7 +1,7 @@
|
||||||
module DeferredJavascriptsHelper
|
module DeferredScriptsHelper
|
||||||
|
|
||||||
# Provides a javascript map of the files in the 'defer' directory
|
# Provides a javascript map of the files in the 'defer' directory
|
||||||
def deferred_javascripts
|
def deferred_scripts
|
||||||
files = {}
|
files = {}
|
||||||
|
|
||||||
Dir.glob("#{Rails.root}/app/assets/javascripts/defer/*.js").each do |file|
|
Dir.glob("#{Rails.root}/app/assets/javascripts/defer/*.js").each do |file|
|
||||||
|
@ -14,7 +14,3 @@ module DeferredJavascriptsHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
module Sprockets::Rails::Helper
|
|
||||||
include DeferredJavascriptsHelper
|
|
||||||
end
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script>
|
||||||
window.assetPath = (function(){
|
window.assetPath = (function(){
|
||||||
|
|
||||||
var map = <%= deferred_javascripts %>;
|
var map = <%= deferred_scripts %>;
|
||||||
|
|
||||||
return function(asset){ return map[asset]; };
|
return function(asset){ return map[asset]; };
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Reference in New Issue