Is it important how you name ClientResources in module.config file?

Member since: 2010

This is my module.config:

<?xml version="1.0" encoding="utf-8"?>
<module>
    <assemblies>	  
        <add assembly="PROJECT.Web" />
    </assemblies>
    <clientResources>
        <add name="epi-cms.widgets.base" path="Styles/Styles.css" resourceType="Style"/>
        <add name="tinymce.plugins.extendedepilink" path="Styles/TinyMce.css" resourceType="Style"/>
    </clientResources>
    <dojo>
        <paths>
            <add name="PROJECT" path="Scripts" />
        </paths>
    </dojo>
</module>

    

Still, ClientResources/Styles/TinyMce.css is not loaded, although Styles.css has. I could import TinyMce.css to Styles.css, but since I want to make an Add-on out of this functionality, this is not an option.

I have tried clearing cache/temporary files/app restart... Could it be that the name should match something?

#84760 Apr 07, 2014 12:51
  • The name attribute is used for resource grouping, and resources which aren't "required" by anything won't be loaded.

    When you use epi-cms.widgets.base as name for your style it will become a part of the resource group loaded when the cms ui is loaded. Your tinymce group is however not referenced, and will not be loaded. You can add references to script groups by adding a clientModule section in your config.

    <clientModule>
      <moduleDependencies>
        <add dependency="CMS" type="runAfter" />
      </moduleDependencies>
      <requiredResources>
        <add name="tinymce.plugins.extendedepilink" />
      </requiredResources>
    </clientModule>
    

    This will load your resources when the CMS module has been loaded.

    You can also add a client side initializer function to the clientModule element.

     

    #84975 Apr 10, 2014 13:22
  • Member since: 2010

    Thx so much, works like charm.

    Just one minor issue, type should be RunAfter instead of runAfter (in this version at least - it's 7.5.1003.0)

    #85043 Apr 11, 2014 16:24