November Happy Hour will be moved to Thursday December 5th.

Custom EPiServer GUI dojo widget / referencing external libraries and stylesheets

Vote:
 

Hi

 

I'm trying to create a custom dojo widget that snaps in to the AssetsPanel, this works fine. My problem is that I would like to reference an external js file that exists on a remote server ex: http://10.0.0.1/test.js.

On a standard web site I would just add a <script> tag in <head> to get access to it. But how would I go about doing this so that the widget get accesss to the script file when it is inside the EPiServer GUI?

 

I would also like to reference some external styelsheets in the same fashion.

 

Thanks in advance!

 

 

/Fred

#65949
Feb 15, 2013 14:33
Vote:
 

Try to define client resources that you need to plug-in in your module manifest (module.config file). Your module.config probably contains assembly name of your module and dojo module configuration.

Define your external resources in clientResources section and reference them in clientModule/requiredResources section. Something like this:

<?xml version="1.0" encoding="utf-8" ?>
<module loadLocalBin="false">

<!--...omitted configuration...-->
  
  <clientResources>
    <add name="your.module.script" path="http://10.0.0.1/test.js" resourceType="Script" />
    <add name="your.module.styles" path="http://10.0.0.1/Styles/Style1.css" resourceType="Style" />
	<add name="your.module.styles" path="http://10.0.0.1/Styles/Style2.css" resourceType="Style" />
  </clientResources>

<!--...omitted dojo module configuration...-->
  
  <clientModule>
    <requiredResources>
      <add name="your.module.script" />
	  <add name="your.module.styles" />
    </requiredResources>
  </clientModule>
    
</module>

    

#65955
Edited, Feb 15, 2013 15:16
Vote:
 

For more details please see this section in EPiServer Framework SDK that describes module.config settings.

#65956
Feb 15, 2013 15:21
Vote:
 

Sweet!

 

Thank you Dmytro!

#65957
Feb 15, 2013 15:27
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.