Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Is it possible to render a js file with Rails and minify the output?
- def action_name
- js_code = render_to_string 'your_js_code_view'
- js_code.gsub!(/rn|r|n/, '') #and/or any other minimization you like
- render 'the_view_wich_will_show_the_minimized_js_code'
- end
- respond_to do |format|
- format.js { self.response_body = minify(render_to_string) }
- end
Add Comment
Please, Sign In to add comment