0

we use DNN, 2sxc and write 2sxc-modules for our needs with the help of the 2sxc Content object.

In one DNN-installation we have several portals (websites), all portals share the same 2sxc and the same custom skin "XYZ".

Our 2sxc cshtml-templates are stored in the folder Portals/_default/2sxc/Content/, for example Portals/_default/2sxc/Content/history-module.cshtml.

Our skin folder is Portals/_default/Skins/XYZ/. Our main CSS file is Portals/_default/Skins/XYZ/xyz-skin.css.

We are not sure what is the best place to store CSS of our 2sxc cshtml-templates, so the question is about it. For example:

  1. Should the CSS of our custom History Module be stored directly in the history-module.cshtml in a <style>....</style>, so everything lays inside the 2sxc/Content/ folder?

  2. Or should the CSS of our History Module rather be stored in our main CSS file xyz-skin.css inside the Skins-folder? Where the file "xyz-skin.css" is included in Portals\_default\Skins\XYZ\footer_dnnincludes.inc.aspx the following way:

<dnn:DnnCssInclude ID="BootstrapCSS" runat="server" FilePath="assets/bootstrap-v4_3_1/bootstrap.min.css"  PathNameAlias="SkinPath" />
<dnn:DnnJsInclude ID="BootstrapJS" runat="server" FilePath="assets/bootstrap-v4_3_1/bootstrap.bundle.min.js" PathNameAlias="SkinPath" />
<dnn:DnnJsInclude runat="server" FilePath="assets/js/xyz-main-js-file.js" PathNameAlias="SkinPath" />
<dnn:DnnCssInclude ID="MainSkin" runat="server" FilePath="xyz-skin.css" PathNameAlias="SkinPath" />
  1. Or some other or mixed solution?

What is the correct way and what is best for the site performance?

RCC
  • 3
  • 4

1 Answers1

0

The correct way is to put the CSS in an own file inside the app folder of that specific app.

It should then only be loaded if needed. So the App should then make sure the CSS is loaded.

Please check out the many sample apps on 2sxc.org/apps like the blog, news, etc. There you can see how it's done.

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21