minify inline js

Mar 4, 2010 at 9:22 AM

hi there, how can i possibly minify inline javascript codes?

Mar 4, 2010 at 11:28 AM

I have no idea why in the world would you want to do that - it will have a performance effect, when rendering pages, and it will also increase the page size. Keeping your JS files separate allows end users to cache them, which means overall faster experience in both sides...

But if you are sure that you know what you're doing, the JavaScriptCompressor class does contain a

public static string Compress(string javaScript)

and quite some overloads for it, so in theory, you should be able to just import it and use directly. But once again - I'd suggest you do not do that :)

 

Coordinator
Mar 4, 2010 at 12:39 PM

/\___ what he said :)

Mar 8, 2010 at 6:08 AM

as of now my js code have server side codes within it like this one <%= extfpnlUserCompanyInfo.ClientID %>, if i were to put it in a separate js file then i would need to pass all item names as parameters

Mar 8, 2010 at 7:01 AM

Anyhow, this is probably what you should be ending doing for several reasons (code re-usability, minification and caching of your JS files)