Skip to content
This repository has been archived by the owner on Jul 2, 2018. It is now read-only.

Loads a set of files to an HTML page based on a library ID. Supports JavaScript, CSS, or VTL. Supports shared hosts by setting the host's ID in the plugin's plugin.properties file. Has built in support for all Google Hosted Libraries without needing to upload any files to your server. Also enables you to use the BoxJS/CSS proxy CDN service for m…

License

Notifications You must be signed in to change notification settings

fienen/com.learndotcms.plugins.resourceloader

Repository files navigation

Resource Loader Plugin for dotCMS

Installation

  • Download and extract the plugin package to your {DOTCMS_ROOT}/plugins directory.
  • Edit conf/plugin.properties and enter the identifier for your server's shared host, if applicable.
  • Edit conf/plugin.properties and change the file asset's structure name and Velocity variable name, if necessary.
  • Shut down your server ({DOTCMS_ROOT}/bin/shutdown.[sh|bat]).
  • On your server, run 'ant clean-plugins deploy-plugins'.
  • Start your server back up ({DOTCMS_ROOT}/bin/startup.[sh|bat]).

Usage

  • Upload files using the Web Resource file asset type, be sure to give them a resource ID (letters, numbers, dashes only). Multiple files can share a Resource ID, and they will all load when the macro is called. Loading is limited to .js, .css, and .vtl files.
  • You can use one of the default Google CDN values ( angularjs, chrome-frame, dojo, ext-core, jquery, jqueryui, mootools, prototype, scriptaculous, swfobject, webfont ) without having a local copy of the file.
  • In your template or other Velocity code, use the macro #loadResource(resourceName)
  • Optionally, you can set $resourceCache [int], $commentBreaks [bool], $htmlDebug [bool], $forceSsl [str: none,never,aways,relative], $boxCss [bool], $boxCssMinify [bool], $boxCssCache [bool], $boxCssVersion [str], $boxJs [bool], $boxJsDefer [bool], $boxJsAppend [bool], $boxJsMinify [bool], $boxJsCache [bool], $boxJsVersion [int]. See the comments on the macros-ext.vm file for a full explanation of each variable and its purpose.
  • Any custom settings will persist over multiple uses of the loadResource() macro, they must be manually reset if you wish to use different settings at different times.
  • If you enable $boxJs usage and set $boxJsDefer to true, you must manually place <script>box.get();</script> on your page where you want the JavaScript to come in at.

Examples

## BASIC EXAMPLE
#loadResource('jquery')
#loadResource('ourPhotoGallery')

## ADVANCED EXAMPLE
#set($boxCss = true)
#set($htmlDebug = true)
#set($resourceCache = 3600)
#loadResource('foundation')

About

Loads a set of files to an HTML page based on a library ID. Supports JavaScript, CSS, or VTL. Supports shared hosts by setting the host's ID in the plugin's plugin.properties file. Has built in support for all Google Hosted Libraries without needing to upload any files to your server. Also enables you to use the BoxJS/CSS proxy CDN service for m…

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages