DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Best Practice to store Custom CSS/JS in Resources folder

 8 Replies
 2 Subscribed to this topic
 40 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 22
New Around Here

Hi Team,

just wanted to check, Is there any harm to store custom CSS/JS in Resources folder. is there any chances that it can be overwritten when we upgrade DNN. 

Do we have any best Practice to store Custom CSS/JS in DNN e.g. site assets or desktop folder etc.

Thanks in advance!

Veteran Member
Posts: 546
Veteran Member
MVP
MVP
You're an MVP!

you may store custom css in portal.css file or any css/JS in individual skin folder or any custom subfolder folder inside /desktopmodules or /providers

New Around Here
Posts: 22
New Around Here

Thanks a lot, Sebastian Leupold 

Is it bad to store custom files in the Resources folder? is there any chance that it can be overwritten when we upgrade DNN?

Veteran Member
Posts: 1246
Veteran Member
MVP
MVP
You're an MVP!
Not necessarily a bad idea, but there are probably better places to store custom files. And the answer to "where" depends on the intended purpose of the custom files. What is the use of the files?
New Around Here
Posts: 22
New Around Here

thanks, Joe Craig

Idea is to create a common module for all shared static resources.

These are CSS/JS shared files across the portals, which we want to put in the Resources folder through the install package.

Veteran Member
Posts: 1246
Veteran Member
MVP
MVP
You're an MVP!
I'd probably use a custom folder, and I'd also probably put it in Portals/_default to make sure that it's more accessible to the Global Assets manager.
Veteran Member
Posts: 546
Veteran Member
MVP
MVP
You're an MVP!
/Resources is usually kept for DNN system resources and common JS libraries (installed by DNN), like jQuery and Knockout.
Resources, you need for your custom extensions, should be placed in /desktopmodules/ or /providers/ subfolder, preferably using an individual name prefix or all stored in subfolders of a company folder, like /desktopmodules/mycompany/mymodule/ or /desktopmodules/mycompany/shared/. This convention prevents name conflicts and your libraries are easily identificable.
For design files, DNN uses for historical reasons subfolders inside /portals/_default/skin/, /portals/_default/container/, /portals/[portalid]/skin and /portals/[portalid]/container. these are the best places for most of your visual resources, which are not tight to functional extensions. Have a look at existing folder structures of modules and themes included with DNN or availaible on this site or in the store.
Just ask, if you still are having any questions :)
Senior Member
Posts: 1322
Senior Member
3 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
Lifesaver
Lifesaver
You're Life Saver!
New Poster
New Poster
Congrats on posting!
3 Engaged Reader
Engaged Reader
You are an engaged reader!
Posted By Jasbir on 06 Apr 2021 02:09 PM

thanks, Joe Craig

Idea is to create a common module for all shared static resources.

These are CSS/JS shared files across the portals, which we want to put in the Resources folder through the install package.

As long as you use a unique path, these will not be overwritten.
BTW, you can create a package just for installing resources.

https://www.dnnsoftware.c...sourcefile-component

 

 

Veteran Member
Posts: 1182
Veteran Member
MVP
MVP
You're an MVP!

There is also a module for that I use quite often: Will Strohl's Content Injection, available here: github.com/hismightiness/dnnextensions. The current release can be found here.

Happy DNNing!
Michael

Michael Tobisch
DNN★MVP

DNN Connect

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved