[thelist] ASP (not .net) script to pre-compile + cachemultipleCSS files?

Ken Schaefer Ken at adOpenStatic.com
Wed Jun 27 23:44:48 CDT 2007

Why do you want to do this using ASP?

Surely you'd be better off running this on your development machine (e.g. by
writing a simple vbs/wsf/js file) and then uploading the resulting single
.css file to your server?


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Jon Hughes
Sent: Thursday, 28 June 2007 4:37 AM
To: thelist at lists.evolt.org
Subject: Re: [thelist] ASP (not .net) script to pre-compile +
cachemultipleCSS files?

> You could add in caching as well by writing
> the result to its own file. and then just reading that on subsequent
> requests.
> --

Alright, so to be sure:

Set objFSO = CreateObject("Scripting.FileSystemObject")

opName = "global.css"
Set outFile =  objFSO.OpenTextFile(opName,8, True)

'Loop through input files
Set srcDir = objFSO.GetFolder("style/global/.")
Set files = srcDir.Files

For Each file in files

If objFSO.getExtensionName(file) <> "css" AND objFSO.getFileName(file)
<> opName Then

'On Error Resume Next

Set fileN = objFSO.OpenTextFile(file, 1)
content = fileN.readAll
outFile.Write content

If Err.Number <> 0 Then
Wscript.Echo Err.Description & ": " & fileN
End If

End If


WScript.Echo "Done"

Because I am writing this to global.css, every time someone visits the
page (aside from the first time) they will use their local cached
version, and not re-download it?

(p.s. I am unable to test this script currently, so I don't know if it
works like I think it should...)

More information about the thelist mailing list