greeting rails and javascript guru!
I have a project where I am returning a large javascript file.
Do not answer me. Format | Format.js end
block.
I am trying to understand how the .js response can be reduced or abbreviated as the .js.erb is full of the view
< Div class = "post-text" itemprop = "text",>
OK, maybe I have a solution:
Do not answer me. Format | Format.js {self.response_body = minify (render_to_string)}
This works perfectly It is certain that the key is the minify method. You will find many JS minifiers. For example, you can use this one (if license allows): - It is based on Crockford's JSMMNC.
If you put this file in your lob, it is required, your minimum method can look like this:
DIF minify (content) min = Smurf :: Javascript.new (content) min.minified end
Hope this helps you.
If you are planning to reduce your automation, then you should probably go for a piece of middleware. It is surprising that I could not find any (many for CSS / JS But it does not have dynamic content about static assets), but there will be no problem writing it.
Comments
Post a Comment