Try our conversational search powered by Generative AI!

Allow CMS Users to upload custom CSS File

Vote:
 

Hi,

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?

Regards
Khurram

#89103
Aug 07, 2014 12:21
Vote:
 

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.

#89129
Aug 08, 2014 5:33
Vote:
 

Get some inspirations from David: http://www.david-tec.com/2014/02/Using-Virtual-Template-System-for-EPiServer/

Made a really great tool.

#89131
Edited, Aug 08, 2014 8:16
Vote:
 

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.

#89173
Edited, Aug 08, 2014 16:09
Vote:
 

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.

Regards
/Khurram

#89526
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.