Using a CSS URL Data Type in the CSS File of a Gadget
You can use a CSS URL data type in the CSS file of the gadget.
To use a CSS URL data type in the CSS file of a gadget
Prefix the relative path with CONTEXT___ROOT followed by the relative path of the gadget. CONTEXT___ROOT automatically resolves to the application context root value during runtime by the gadget framework. For example:
@font-face {
font-family: 'My Glyphicons Halflings';
src: url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.eot);
src:
url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.eot?#iefix)
format('embedded-opentype'),
url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.woff2)
format('woff2'),
url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.woff)
format('woff'),
url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.ttf)
format('truetype'),
url(/CONTEXT___ROOT/FontCssGadget/styles/fonts/
glyphicons-halflings-regular.svg#glyphicons_halflingsregular)
format('svg');
}
.imagecss-sample-gadget {
background-image: url('/CONTEXT___ROOT/FontCssGadget/images/logo.png');
height: 100px;
width: 150px;
}
Here CONTEXT___ROOT is replaced by the <application_name> that you provided while creating the CAF portlet or web application.