Difficulties adding my own CSS to style LabKey interface

LabKey Support Forum
Difficulties adding my own CSS to style LabKey interface olnerdybastid  2018-03-29 12:19
Status: Closed
 

I have a few questions stemming from my recent attempt to add CSS to an interface we're building in LabKey. In case it's relevant for troubleshooting, the UI I'm trying to build is located within a wiki web part. I've tried the following 3 approaches so far without success, and am curious to know why these methods aren't working (or in the case of the first, isn't working as expected).

  1. First, I followed the documentation here (https://www.labkey.org/Documentation/wiki-page.view?name=customizeLook#resources) and uploaded my own test CSS file. This method worked, but it seems as though LabKey cached the first CSS file I uploaded, and it now loads the same one each time--even after I deleted the file and tried to upload a new one in its place. Accessing our LabKey server (and after restarting Tomcat) from a different browser still loads that same CSS.

  2. Next, I put my CSS file (lkmain.css) in the same folder as the other out-of-the-box LabKey stylesheets (for me, the full path is /Applications/labkey/labkeywebapp/core/css) and added the following line to my javascript:

'LABKEY.requiresCss('core/css/lkmain.css');'

This throws a 404 error each time I load the page saying that resource can't be found. If I point to one of the predefined LabKey CSS files in that folder I don't see the same error.

  1. Finally I tried to link to my CSS (located in the same path as before) from within the <head> of my HTML. No error gets thrown this time, but the CSS I linked to isn't being loaded (as verified by looking at the Resources tab of the Developer console in Safari).

Any suggestions/explanation of why these methods aren't working would be most appreciated.

 
 
olnerdybastid responded:  2018-04-03 15:55

Updating to say that the 'problem' with option #1 was entirely user error on my end: my initial test CSS was uploaded as a project resource (project settings -> resources tab), whereas my subsequent changes to the custom CSS were all at the site-level (admin console -> look and feel settings -> resources tab). Since it looks as though the project-level CSS supersedes the site-level one, the latter wasn't getting loaded when I viewed my wiki.

Still curious to know why/if approaches 2 and 3 don't work though.

 
Jon (LabKey DevOps) responded:  2018-04-08 00:16

Hello,

Did you set the permissions and the owner properly on those custom CSS files to match up with the other ones?

Regards,

Jon