css javascript Jahia 7.3 Jahia 8

Include css/javascript from a third party folder from a module

Question

How can I include a css/js file from another folder as css or javascript in the module?

Answer

As other folders are blocked in the module. You have to add the folder where the css/js is stored to the static resources in manifest (pom.xml) of the module like (e.g. the additional folder is vendor):

 ...
    <properties>
        <jahia-depends>default</jahia-depends>
        <jahia-static-resources>/css,/icons,/javascript,/swf,/vendor</jahia-static-resources>
    </properties>
... 

Now the css file will be available. Now you can use the addTemplate tag. NOTE: the addTemplate tag base the css folder!!

So you have to add something like:

 <template:addResources type="css" resources="../vendor/myVendor.css" />