Try our conversational search powered by Generative AI!

Allow CMS Users to upload custom CSS File



We want to provide CMS Editors a CSS file so they can add Custom CSS for there whole General public site. (They have a html developer who will keep changing css for the site). 

e.g. they may change background of their site occasionally.

How can we achive this?


Aug 07, 2014 12:21

We have done this quite often for editors that have the knowlege to write their own css.  They way we do it, we create a property on the start page of type ContentReference

[Display(Name="Css File Override")]
[UIHint(UIHint.MediaData)] <- off the top of my head public virtual contentreference {get;set;}>

This is how we do it.  Apparently my tablet won't let me edit the property but i forgot to type the property name.  if your using webforms, you can do the same thing but get the property from the start page   UrlResolver.Current.GetUrl(ContentLoader.Instance.Get().Get(SiteDefinition.Current.StartPage).CssFileOverride).  Probably best to do some null checking in there and not put it all in one line but you can see what i am doing there.

Aug 08, 2014 5:33

Get some inspirations from David:

Made a really great tool.

Edited, Aug 08, 2014 8:16

Many Thanks

@Valdis: I tried solution It saved Virtuala file in DDS. I can reference my file as href="/assets/css/custom.css" rel="stylesheet"/> as data will be picked from physical file. 

@Joshua: I will try and will update you.

Edited, Aug 08, 2014 16:09

Hi Joshua, 

This is what we also have been doing before. But was not working with my this project. Culrprit was Blob Provider for cloudianry as it was not loading CSS files in Raw Format and on accessing I was always getting NoImageFound.Jpg and in result styles were not applying. I fix that and it is working now.


Aug 19, 2014 12:50
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.