Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more
Even if the user interface in EPiServer is based on the Dojo framework, the jQuery framework will still be supported and available. In EPiServer 7, only the standard jQuery library will be generally available.
The theming is based on the Dijit theming support using .less when assembling the final theme css files. There is no explicit support for theming of jQuery UI widgets, but a base set of CSS rules will be loaded which will style the most common HTML elements. Additional CSS rules can be included in css files registered using the client side module configuration.
Since the standard theme is based on less with colors and sizes defined in a separate less file, you can reuse this when theming other UI elements. When the EPiServer Framework msi package has been installed you will find this file in the folder C:\Program Files (x86)\EPiServer\Framework\<version>\Application\UI\ClientResources\dojo\dijit\themes\Sleek.
To reuse this file you must use .less or its .net cousin to compile your less stylesheet into CSS.
The following example shows very briefly a .less file importing common variable declarations and then using a shared color definition in a general purpose CSS class:
@import "variables.less"
.header {
color: @text-color
}
Since a lot of different client side frameworks exist which can be used simultaneously in the same application, a demand for communicating between them arises. To remedy this, there is a message passing service designed for passing messages between frameworks. The jQuery framework is registered by default.
When registering a toolkit we inject a proxy function instead of the original, enabling us to eavesdrop on what is being passed around in that toolkit. If the criteria for the message are met we pass it along to the other participating toolkits.
From Dojo it is very easy. Just use the ordinary dojo.publish
and dojo.subscribe
.
To publish a message, supply the channel and the arguments:
$.event.trigger("/channel/messageName", arguments);
To subscribe (or listen) to messages, bind to any node (for example, document) with the channel and the event handler:
$(document).bind("/channel/messageName", function(){})
The example below shows how the jQuery is registered:
epi.shell.messaging.registerLibrary("jquery", $.event, "trigger",
function (event, data, elem) {
if (typeof event == "string" && !elem) {
return true;
}
return false;
});
The parameters, in order of appearance:
Last updated: Feb 23, 2015