4

The custom.css and all other css files under Themes folder \Website\sitecore modules\Shell\Web Forms for Marketers\Themes gets loaded in web browser on vanilla version of Sitecore 8.1 update 3 but it does not work on my project instance. I believe the developer who worked on it before me has made some changes to pipelines which call these css files to load.

Theme files

Sitecore

I cannot seem to find anything related to this on internet.

Any suggestions?

1

if you want to load CSS from custom files you need to include into : \Website\Views\Form\Index.cshtml.

This is a content of the file:

@using Sitecore.Form.Core.Configuration
@using Sitecore.Forms.Mvc
@using Sitecore.Forms.Mvc.Html
@model Sitecore.Forms.Mvc.ViewModels.FormViewModel
@{
  ViewContext.ViewData.TemplateInfo.HtmlFieldPrefix = Model.ClientId;

  var styles = new List<string> { "content/themes/base/all.css", "content/Fields.css" };

  var scripts = new List<string>
  {
    "libs/jquery/jquery-2.1.3.min.js",
    "libs/jquery/jquery-ui-1.11.3.min.js",
    "libs/jquery/jquery.validate.min.js",
    "libs/jquery/jquery.validate.unobtrusive.min.js",
    "wffm.min.js",
    "main.min.js"
  };

  if (Sitecore.Forms.Mvc.Settings.EnableBootstrapCssRendering)
  {
      styles.Add("content/bootstrap.min.css");
      scripts.Add("libs/bootstrap/bootstrap.min.js");
  }
}


@Html.RenderStyles(styles.Select(s => Constants.ScriptsBaseUrl + s).ToArray())
@Html.RenderStyles(string.Format(StaticSettings.CustomCssPath, string.Empty))
@Html.EditorFor(x => Model)
@Html.RenderScripts(scripts.Select(s => Constants.ScriptsBaseUrl + s).ToArray())

You can modify this line to add your custom css file :

var styles = new List<string> { "content/themes/base/all.css", "content/Fields.css" };
  • Thank you for replying. But originally my question is that sitecore Web forms load Default.css by default and MVC forms loads custom.css. This does not happen on the instance I am working on. The Sitecore screenshot above shows the website folder has reference to Themes field and it has an option to select different theme files e.g. Default.css, Custom.css. Left-Oriented.css etc and it does not work on my instance. I am interested in knowing what caused the Default.css and Custom.css to load by default? – Adil Rao Jul 20 '17 at 1:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.