Link to home
Start Free TrialLog in
Avatar of AidenA
AidenA

asked on

vb.net: Compress js and css files to improve webpage loading times

Hi, I just want to compress my css and javascript files when they are sent to the client. Looking on the internet I can see lots of stuff in c# but just haven't been able to easily see how to do this in vb.net or even what way i should go about it (seems to be some people are putting code into the global.asax file or others using php or something... not sure)

How can I gzip (or deflate) my js and css files in vb.net. I'm using IIS7.
ASKER CERTIFIED SOLUTION
Avatar of Umar Topia
Umar Topia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of KBerger
KBerger

Hi,

try Miron Abramson's Compressor/Minifier

http://mironabramson.com/blog/post/2008/06/High-performance-css-minifier.aspx

We are using this component in some of our production-applications. You will just have to install it, make some changes to your web.config. With basic installation and configuration you will have already good results. You can also adopt your aspx-files, so that many single JS or CSS files get combined to one big file, which reduces HTTP-overhead.

Regards,

-Kristof
Avatar of AidenA

ASKER

Hi, thanks,.

@umartopia: I'd seen some of those sites before and I'm still not clear on how to go about it from that site to be honest. I looked at the site relating to IIS7 but I wasn't convinced this is was the best way to do it. He was saying things like the site only compresses when hit by two different ip addresses and I wasn't clear whether this was the standard process so moved on.

@CodeCruiser: All those links use C#. The third one is just for minification I think also. Is there no simple way to do this other than use some utility in which I've no real visibility? What do you use yourself for such a task?

@KBerger: This looks like a minifier and also it's in C#. I was more interested in compression and preferably to be able to do it myself so I can understand and control what's going on
Hi,

well, actually it is a compressor as well (Gzip). What do you mean by "want to control what's going on". Why? The component will compress your content with GZip.
I guess you can download the source-code somewhere and if not, use reflector to look at it.
Why would you take the risk of implementing a component taht has been implemented by others and has undergone bugfixing and production experience?
Are your requirements more special than just "compress my data" ?

Regards,

-Kristof
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AidenA

ASKER

ok well i better just pick one of these things to begin with first. @KBerger: Since you've used this before, how do I use it? It looks like just a cs class. What am i doing with this? Is it minifying at runtime before being sent to the client or am I using it before posting to production server?

And, which is better? Presumably it would be better to have the files already minified on the server I presume instead of getting IIS or whatever to zip before it is sent

(also, this isn't using gzip or deflate then?)
Avatar of AidenA

ASKER

as an example of something which may (or may not) be simple... take a look at this link

http://www.fiftyfoureleven.com/weblog/web-development/css/the-definitive-css-gzip-method

now, I've never used php and know nothing about it... but what do you guys make of that?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AidenA

ASKER

experts helped me figure it out, solution is in final comment