stylesheets in "CSS" folder not being loaded
Hello,
I apologize if this has been covered, but I wasn't able to find it mentioned anywhere.
Whenever I link to a stylesheets within the CSS folder of my theme, the file is not found.
I have a theme installed/added and recognized under "Frontend themes" in the "Administration" menu. The CSSLoadOrder is correctly displaying all of the stylesheets within the Global folder. Also, all images under the Images directory display correctly when referenced. My problem is just referencing the files within the CSS folder.Hello Scott,
Actually, as long as you have your styles in the Global folder of the theme, as in the attached image, you don't need to reference them again with a css widget. they will be loaded authomatically. If you need to load external css files (which will not be part of the theme) you can use the widget, but I will recommend you to place those styles in a folder with a different name and outside the theme, because you may experience some permissions problems.
Kind regards,Thank you Jen. The stylesheets I'm trying to load are not meant to be part of a theme, so I'll try to add a different "Styles" folder on the same level as "Global".
I was confused because the folder structure that Sitefinity suggests puts a folder called "CSS" on the same level as "Global" and that's what I'm trying to use. I'll see if renaming it helps at all.
Thanks again.
- Scott
I solved my problem. The issue was that the Sitefinity widget was not entering the right path. This could be just our installation and configuration.
When I selected a CSS file, the path would be something like "dev.domain.com/.../styles.css".
Sitefinity wouldn't find that file. So I removed everything from the beginning of the URL through App_Data, leaving "/Sitefinity/...". This works.
I'm not sure why Sitefinity is applying incorrect URLs. Again, it may be our installation, but we setup our structure to match Sitefinity's suggestion: www.sitefinity.com/.../website-templates-file-structure.
I'll look into configuration settings on this on my own, but can anyone point me to a spot where this path adjustment could be made globally?
Thanks,
Scott
Hey Scott,
The structure you refer to is correct, and for themes it is the correct folder path to input (www.sitefinity.com/.../registering-a-theme).
A CSS Widget however is just like a regular link tag, as in it has no access to the /App_Data folder.
To accomodate for that, Sitefinity basically 'rewrites' the path and removes the /App_Data part of the url.
So both dev.domain.com/.../.... and /Sitefinity/... would work, it's just a .NET restriction that you can't reference the App_Data folder.
Jochem, thank you for the explanation. It makes total sense. The puzzling thing about the CSS Widget is that it didn't remove the "App_Data" part of the URL. I had to do it manually. That's my concern. Is there some tweak that I have to make to my installation of Sitefinity to get the CSS (and possible Javascript) widgets to work correctly and remove the "App_Data" part of URLs? Is there a setting I can check to make sure it's not on our end? Is it somehow a bug?
Thanks for the feedback. This is very helpful.
Hey Scott,
No as far as I know its not something on your end.
When you select a page by the browse button, it simply translates that folder/file into a url by pasting the domain in front of it and not checking if it is a valid url. To be honest you should try and avoid using those full urls and change them to partials if you can.
By default you end up with something like this:
localhost/.../galleria.classic.css
~/Sitefinity/WebsiteTemplates/bpd2column/App_Themes/bpd2column/Styles/galleria.classic.css
Jochem