[PUB] How do you dynamically load local javascipt files from file system to include as a javascript library
In a pub template you are able to add a javascript library
and use similar format
<Script src= "https://httpserver/JazzPublishingScripts/GlobalSecurityMarkingUtility.js"></Script>
<Script src= "library://api/scripts/7451"></Script>
This works well except when we are developing the libraries when we need to load them of a local file system.
Is there a format that allows you to dynamically load java script from the files system..
Looking for a format like..
<Script src= "scripts/myscript.js"></Script>
or
<Script src= "c:/scripts/myscript.js"></Script>
2 answers
Hi Peter,
In ELM Publishing PUB JavaScript can only be loaded from supported server accessible locations. The supported options are loading scripts from the JazzPublishingScripts directory on the server or from the Document Builder script library.
Using the Document Builder script library allows scripts to be shared across multiple templates and users. These scripts are centrally managed on the PUB server and work consistently in both Studio and during runtime publishing.
Loading JavaScript directly from a local file system is not supported. Examples include referencing scripts from a local folder or from a local drive on an individual machine. This limitation is by design.
Local file system references would only work for a single Studio installation and would not be available to other users or to the publishing server. Allowing local file access would also introduce security concerns in a shared server environment.
For team based development and source control the recommended approach is to maintain the JavaScript source in EWM or another version control system and then deploy the approved version into the PUB Document Builder script library. This ensures scripts are reusable secure and accessible to all users in shared publishing scenarios.
Comments
The solution to use Pub server to host the javascript is a very limited option. You are unable to have version control and you can not access the javascript files from other Pub servers. We are forced to use a separate web server to host the files so that javascript files can be used across servers.
1 vote