Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Managed and unmanaged CSS and scripts. View modes: 
User avatar
Member
Member
robert-tailor.co - 2/12/2013 4:56:27 PM
   
Managed and unmanaged CSS and scripts.
Hi,

I ma using Kentico v7.0.19.

I have a number of different CSS files and javascript files used on one of my sites. Some of these files have been imported into (and managed by) the CMS (Site Settings -> Development -> CSS Stylesheets).

Others are less practical to import (e.g. a specific minified version of jQuery, or one of it's plugins).

How should I reference these files?

I can't include the CSS files in a folder under my main stylesheet because that means they all get imported automatically in the site Master Page, and I have no control over when they should be called, or what order they should be called in.

I can copy them to the App_Theme folder for the specified site, but then that results in a mismatch between the files listed in the CMS and the files listed on the file system.

On the other hand, if I copy them to an unmanaged folder location (e.g. ~/<SiteName>/includes/css, or ~/<SiteName>/includes/javascript) am I right in saying they won't be exported along with the rest of the site data?

So, what is best practice for files like these?

Thanks.

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 7:34:46 PM
   
RE:Managed and unmanaged CSS and scripts.
Use the CMSGlobal folders for your style sheets. On export you have the option of exporting the Global files.

Kentico does have a version of jQuery so not sure why you'd have another (unless you've modified it). You can store all other js files in CMSScripts/Custom/<folder> and edit/manage those within Site Manager>Development JS Files. You can include those files at any time by using:
<link rel="stylesheet" href="/CMSPages/GetResource.ashx?stylesheetfile=/CMSGlobal/SiteName/css/jqModal.css">
<script src="/CMSPages/GetResource.ashx?scriptfile=%7e%2fCMSScripts%2fCustom%2fSiteName%2fmodernizr-2.5.3.min.js"></script>

User avatar
Member
Member
robert-tailor.co - 2/12/2013 7:45:40 PM
   
RE:Managed and unmanaged CSS and scripts.
FroggEye wrote: Use the CMSGlobal folders for your style sheets. On export you have the option of exporting the Global files.

I've searched the entire web project folder structure, and I don't have a CMSGlobal folder.

User avatar
Member
Member
robert-tailor.co - 2/12/2013 7:46:27 PM
   
RE:Managed and unmanaged CSS and scripts.
robert-tailor.co wrote:
FroggEye wrote: Use the CMSGlobal folders for your style sheets. On export you have the option of exporting the Global files.

I've searched the entire web project folder structure, and I don't have a CMSGlobal folder.

Do you mean '~/App_Themes/Global'?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 7:48:21 PM
   
RE:Managed and unmanaged CSS and scripts.
Add it to your file structure, it will be exported when you check the Export global files for your site. To test it out, add the folder and a .txt document to the folder and export a document type and check that box.

User avatar
Member
Member
robert-tailor.co - 2/12/2013 8:07:32 PM
   
RE:Managed and unmanaged CSS and scripts.
FroggEye wrote: Add it to your file structure, it will be exported when you check the Export global files for your site. To test it out, add the folder and a .txt document to the folder and export a document type and check that box.

We must be using different versions (I'm using v7.0.19).

I created a ~/CMSGlobal folder and placed some text documents inside. I went to export my website and got this screen:

User image

There's no option to specify global folders there. I ticked all the boxes and exported the site, but the contents of the ~/CMSGlobal folder weren't exported.

*However*, I did create a folder in the root directory with an identical name to my website (i.e. ~/<SiteName>). The contents of that directory *were* exported.

So, what's the definitive answer here?

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 8:35:37 PM
   
RE:Managed and unmanaged CSS and scripts.
Must be too late of a night for ya, check out the 3rd checkbox from the top in your image, the one right above the unchecked box (Export custom assembly files). You don't have the option to export individual folders/files in the CMSGlobal folder, just the whole folder.

User avatar
Member
Member
robert-tailor.co - 2/12/2013 8:47:29 PM
   
RE:Managed and unmanaged CSS and scripts.
FroggEye wrote: Must be too late of a night for ya, check out the 3rd checkbox from the top in your image, the one right above the unchecked box (Export custom assembly files). You don't have the option to export individual folders/files in the CMSGlobal folder, just the whole folder.

Hi,

I think we're both a bit confused.

I did a search in the Kentico documentation for 'CMSGlobal' and got no results.

The documentation at http://devnet.kentico.com/docs/devguide/index.html?folder_structure_and_importexport.htm references a ~/CMSGlobalFiles folder (in green), which is what I think you meant.

It also suggests using <site code name> (again, in green), which resulted in the behaviour I experienced.

OK - that resolves my query.

:-)

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 2/12/2013 9:06:05 PM
   
RE:Managed and unmanaged CSS and scripts.
Ahh yes you are correct, I forgot the FILES at the end. There are some neat features when you are developing which will allow you to export all your custom code and files without an issue and that document has all the info you need. Best of luck!