Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.88 KB

3.1 Javascript Dependencies.md

File metadata and controls

58 lines (39 loc) · 1.88 KB

![alt text][logo] [logo]: https://raw.githubusercontent.com/leojavier/nopCommerce-Guide/master/Resource/HE-logo.png "Human Elevation PLatform"

nopCommerce-Guide

A Guideline to built your own NopCommerce Themes

##Javascript Dependencies

Javascript dependencies All javascript files for the presentation layer live in the following folder:

ProjectName\Presentation\Nop.Web\scripts\

Adding Javascript files

To load javascript files into your NopCommerce platform you should load it from the _Root.Head file

ProjectName\Presentation\Nop.Web\Views\Shared\_Root.Head.cshtml

Example: 1.0

@{
    var displayMiniProfiler = EngineContext.Current.Resolve<Nop.Core.Domain.StoreInformationSettings>().DisplayMiniProfilerInPublicStore;

    //resources
    Html.AppendCssFileParts("~/Content/jquery-ui-themes/smoothness/jquery-ui-1.10.3.custom.min.css");


    Html.AppendScriptParts("~/Scripts/bootstrap.min.js"); // <-------
    Html.AppendScriptParts("~/Scripts/public.ajaxcart.js");
    Html.AppendScriptParts("~/Scripts/public.common.js");
    Html.AppendScriptParts("~/Scripts/jquery-migrate-1.2.1.min.js");
    Html.AppendScriptParts("~/Scripts/jquery-ui-1.10.3.custom.min.js");
    Html.AppendScriptParts("~/Scripts/jquery.validate.unobtrusive.min.js");
    Html.AppendScriptParts("~/Scripts/jquery.validate.min.js");
    Html.AppendScriptParts("~/Scripts/jquery-1.10.2.min.js");


    //X-UA-Compatible tag
    var commonSettings = EngineContext.Current.Resolve<CommonSettings>();
    if (commonSettings.RenderXuaCompatible)
    {
        Html.AppendHeadCustomParts(string.Format("<meta http-equiv=\"X-UA-Compatible\" content=\"{0}\"/>", commonSettings.XuaCompatibleValue));
    }
}

The example above (1.0) Shows how to add bootstrap's javascript file to the NopCommerce platform.

NOTE: Javascript files are loaded in reverse order (from bottom to top)