[thelist] ASP (not .net) script to pre-compile + cache multipleCSS files?
Jon Hughes
hughesj at firemtn.com
Wed Jun 27 11:37:25 CDT 2007
> 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
Next
outFile.Close
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