Today I am editing the Articulate “VAPOR” theme installed in a hosted website. Initially I edited it from the Umbraco dashboard, save changes and tried to see the changes by refreshing the actual web site. But it didn’t work. I tried almost all other options, clear the cookies, restarted the application pool from the Plesk Admin Panel. Nothing work. Even though I have installed a previous version of Umbraco to a client, I am not sure if all .css files shown in the dashboard are directly reading from/ writing to the physical file or stored in the database. Then to check that I connected to the site via my favourite FTP client WinSCP (I am not using the FileZilla any more.), and I can clearly see the changes I have made from the Umbraco admin dashboard are saved in to the actual file.
Then as everyone does, I google-binged the internet, and found that in several forums that so many people have the same issue with other Umbraco versions and of course with some none Umbraco web sites as well. Clearly it is a caching issue where the browser doesn’t actually requesting the new version of the file from the server and instead uses the one cached in the browser cache.
We can use cache busting technique here. For example
<link rel="stylesheet" href="siteStylesheet.css" type="text/css"/>
to something like this
<link rel="stylesheet" href="siteStylesheet.css?1234571" type="text/css"/>
In Umbraco it looks like all those related theme .css files are minified into file something like this:
<link href="/DependencyHandler.axd?s=L0a-shorten-for-brevity-Y3&t=Css&cdv=601276996" type="text/css" rel="stylesheet">
So what I found is that if we change the ClientDepndancy version number in the “/Config/ClientDependancy.config”it will get the new version.
I will post the content of the ClientDependancy.config file since it also give some more information about the client dependancy framework, which is not the subject of this post, but we can follow the links provided in the code if we want to discover more info about this.
ClientDependancy.config
<?xml version="1.0" encoding="utf-8"?> <!-- For full details of the client dependency framework, visit https://github.com/Shandem/ClientDependency It manages CSS and JS file dependencies per control without having to worry about duplicates. It also manages the combination, compression and minification of all JS & CSS files. NOTES: * Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config * A new version will invalidate both client and server cache and create new persisted files --> <clientDependency version="669187797" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.CdfLogger, Umbraco.Web"> <!-- This section is used for Web Forms only, the enableCompositeFiles="true" is optional and by default is set to true. The LoaderControlProvider is set to default, the javascriptPlaceHolderId, cssPlaceHolderId attributes are optional and default to what is listed below. If using this provider, then you must specify both PlaceHolder controls on your page in order to render the JS/CSS. --> <fileRegistration defaultProvider="PlaceHolderProvider"> <providers> <add name="PageHeaderProvider" type="ClientDependency.Core.FileRegistration.Providers.PageHeaderProvider, ClientDependency.Core" /> <add name="LazyLoadProvider" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadProvider, ClientDependency.Core" /> <add name="LoaderControlProvider" type="ClientDependency.Core.FileRegistration.Providers.LoaderControlProvider, ClientDependency.Core" /> <add name="PlaceHolderProvider" type="ClientDependency.Core.FileRegistration.Providers.PlaceHolderProvider, ClientDependency.Core" javascriptPlaceHolderId="JavaScriptPlaceHolder" cssPlaceHolderId="CssPlaceHolder" /> </providers> </fileRegistration> <!-- This section is used for MVC only --> <mvc defaultRenderer="StandardRenderer"> <renderers> <add name="StandardRenderer" type="ClientDependency.Core.FileRegistration.Providers.StandardRenderer, ClientDependency.Core" /> <add name="LazyLoadRenderer" type="ClientDependency.Core.FileRegistration.Providers.LazyLoadRenderer, ClientDependency.Core" /> </renderers> </mvc> <!-- The composite file section configures the compression/combination/minification of files. You can enable/disable minification of either JS/CSS files and you can enable/disable the persistence of composite files. By default, minification and persistence is enabled. Persisting files means that the system is going to save the output of the compressed/combined/minified files to disk so that on any subsequent request (when output cache expires) that these files don't have to be recreated again and will be based on the persisted file on disk. This saves on processing time. --> <compositeFiles defaultProvider="defaultFileProcessingProvider" compositeFileHandlerPath="~/DependencyHandler.axd"> <fileProcessingProviders> <add name="CompositeFileProcessor" type="ClientDependency.Core.CompositeFiles.Providers.CompositeFileProcessingProvider, ClientDependency.Core" enableCssMinify="true" enableJsMinify="true" persistFiles="true" compositeFilePath="~/App_Data/TEMP/ClientDependency" bundleDomains="localhost:123456" urlType="Base64QueryStrings" pathUrlFormat="{dependencyId}/{version}/{type}" /> </fileProcessingProviders> <!-- A file map provider stores references to dependency files by an id to be used in the handler URL when using the MappedId Url type --> <fileMapProviders> <add name="XmlFileMap" type="ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper, ClientDependency.Core" mapPath="~/App_Data/TEMP/ClientDependency" /> </fileMapProviders> </compositeFiles> </clientDependency>
After changing value 669187797 in <clientDependency version="669187797" to 669187798, save changes and refresh the browser. Now it reflect the css changes I have made earlier.
At this stage I only want to test the css changes, so problem is temporarily solved. But be aware that this is not the correct way of testing. Do not use this method of "changing clientDependancy value" as frequent testing technique on a live site. Umbraco use this file for version upgrades. It is always good to follow the standard development life cycle for themes modifications and testing. Use your local computer for this type of CSS or JS file modifications.
Reference
Comments
Post a Comment