I have an app/assets/javascripts/moufa.js.erb
file that gets populated with values from a config/moufa.yml
file. I want to use the depend_on
sprockets directive so that every time the yaml file gets changed, it recompiles the js file.
We were able to solve this by adding a new directive. This directive (put this in config/initializers/sprockets.rb) adds a dependency on a file in the config/ directory:
class Sprockets::DirectiveProcessor
def process_depend_on_config_directive(file)
path = File.expand_path(file, "#{Rails.root}/config")
context.depend_on(path)
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With