I'm currently exploring splitting one large module into several semi-separate ones. As an example, assume this would yield three modules, A, B, and C (there are more in reality).
-B and C depend on A (won't work if A is disabled).
-A ideally has a list of client dependencies common to B and C defined in its module.xml. For example, bootstrap CSS.
-However, A doesn't necessarily have any components rendered in a particular view and may or may not have helper functions in use at any given time.
Is there a way I can get that CSS to be included when components from B and C are rendered without having to define that CSS as a client dependency in each of their module.xml files? (Bigger question would be can I share JS libs or other stuff as well).
Additionally/alternatively, is there a way I could define a list of site-wide includes in a module of my own without having to modify LabKey's source? Kind of like adding to a master page of sorts.
Thanks! |
|
Jon (LabKey DevOps) responded: |
2017-04-07 18:58 |
Hi Matt,
You can declare the CSS on the module level, the file-level, or the script level, so there is some flexibility there:
https://www.labkey.org/Documentation/wiki-page.view?name=scriptdepend
But without declaring the dependency somewhere, you're subjected to the CSS that is used within LabKey.
Additionally, you should still be able to share JS libs as well, so as long as you can get the appropriate paths as explained in the docs link above.
I'm not certain I'm understanding your last question:
"Additionally/alternatively, is there a way I could define a list of site-wide includes in a module of my own without having to modify LabKey's source? Kind of like adding to a master page of sorts."
I might be misunderstanding this, but are you trying to add a list to the entire platform? What is the purpose of this list?
Regards,
Jon |
|
Matt V responded: |
2017-04-11 10:49 |
Hi Jon,
Thanks for the reply.
In this specific instance, I'm trying to add a JS/CSS files so that they're included on every page of my instance, regardless of whether or not my module is actually doing anything else. Testing shows it's only active under some circumstances, like I'm doing something with the footer, rendering a webpart, etc. Using the link you provided, they're not always included, for example, when I'm managing a data set. I tried adding them as <script> and <link> in a _footer but the page appears to try to render before the files are included, leading to a bunch of x is not defined errors or styles that aren't actually applied.
The last question was referring to the HomeTemplate files under /server/api/src/org/labkey/api/view/template/. In other tools there are master pages, templates, etc. that define the site-wide look. I was wondering if there was such a class or template I could touch, override, extend, etc. as a way to get the JS and CSS included in the manner I need. |
|
Jon (LabKey DevOps) responded: |
2017-04-27 18:36 |
Hi Matt,
Thanks for your patience.
I was able to confirm that the only way to have JS/CSS files applied to all pages is to update the core code and recompile our Java libraries that dictate what JS and CSS to use by default. Modules will only dictate CSS and JS for whatever that module is applied to, so unless you choose to apply your module to all projects and folders, you're options are limited since the extensibility only will apply to modules and not the core code.
Regards,
Jon |
|
|
|