0

In Rails, I want to drive the asset pipeline to compile and minify my js file and get the result as a string. The js file uses sprockets to combine multiple files together.

How can I do this?

This needs to be run from a controller action. It's not as simple as just serving an asset, rather, I want to get my compiled and minified JS as a string and then do something with it.

1 Answers1

0

You can do something like this to access your asset.

view_context.asset_path 'your_file.js'

Check this question also

How does one reference compiled assets from the controller in Rails 3.1?

Community
  • 1
  • 1
Serdar Dogruyol
  • 5,147
  • 3
  • 24
  • 32