Matthew Grima
Matthew Grima

Reputation: 1523

Best practice to maintain minified files and deployment/development

I'm stuck in a bit of dilemma on how to get around this and was hoping someone would point me in the right direction.

I am trying to cut down on the size of css and javascript files to improve our website's performance. But the problem is, on deployment, we simply upload our current svn repository's latest development version onto the server.

I am finding it hard to add that extra step for every developer to minify files before every change, as it adds a risk for negligence and human error.

I was thinking about having the readable version of files on the server anyway, but having some kind of file monitor that will execute a minifier when a file is changed, and update the file used by the website. Has anyone implemented this before?

EDIT

We're currently running on ASP.Net 2.0, Windows Server 2003

Upvotes: 6

Views: 2739

Answers (2)

Matt Wrock
Matt Wrock

Reputation: 6640

If you are using .net on the server, you could also try RequestReduce available on Nuget. It minies and bundles your css and js and also sprites css background images. It does it on the fly so your devs don't have to do this as an extra step. As long as you have some kind of versioning in place that changes the css/js url when it is changed, RequestReduce will automatically detect the change and process the file. It does all of this in the background and there fore does not affect the response time. If the files are not versioned via the url, RequestProduce provides a dashboard where you can flush its cache. RequestReduce can be deployed with absolutely no code changes and hardly any config in most use cases.

Upvotes: 2

Alex Dn
Alex Dn

Reputation: 5553

If you are using ASP.NET, try MBCompression library - it minify files automatically and you don't need do it manually:

Upvotes: 1

Related Questions