The <ISFILEBUNDLE>
tag allows you to bundle multiple smaller source files into one big file and to configure processors for the bundled files. <ISFILEBUNDLE>
has the two supporting tags <ISFILE>
and <ISRENDER>
.
Each file bundle must have one <ISRENDER>
tag. <ISRENDER>
provides a render method for all resulting files of this file bundle. The attribute 1831116388is the name of the bundle or the name of one of the configured files.
A file bundle must have one or more <ISFILE>
tags. <ISFILE>
is used to declare files to be processed via its name attribute.
All <ISFILEBUNDLE>
tags must have one <ISRENDER>
tag.
The <ISRENDER>
tag provides a render method for all resulting files of this filebundle. This tag is only allowed inside an <ISFILEBUNDLE>
tag.
The following example shows how to use <ISRENDER>
. The URL of the target file consists of the path of the web root and the file name.
<head> ... <isfilebundle name="/bundles/BundledCSSFile.css" processors="CSSCompressor"> <isrender> <link type="text/css" rel="stylesheet" href="#webRoot().'/'.File:Name#" media="all"> </isrender> <isfile name="/css/CSS_File1.css"/> ... <isfile name="/css/CSS_File3.css"/> </isfilebundle> <isfilebundle name="/js/bundles/BundledJSFile.js" processors="JSCompressor, SemicolonAppender"> <isrender> <script src="#webRoot().'/'.File:Name#"></script> </isrender> <isfile name="/js/JS_File1.js"/> ... <isfile name="/js/JS_File4.js"/> </isfilebundle> ... </head>
The previous example uses only the name for the URL. A web developer may run into browser cache problems. Because the URL does not change when the file content changes. To avoid such problems it is helpful to append the modification date of the target file. Use <ISPRINT>
to print the variable lastModified
(integer) in the correct format.
... <head> ... <isfilebundle name="/bundles/BundledCSSFile.css" processors="CSSCompressor"> <isrender> <link type="text/css" rel="stylesheet" href="#webRoot().'/'.File:Name?lastModified=<isprint value="#File:LastModified#" formatter="0">#" media="all"> </isrender> <isfile name="/css/CSS_File1.css"/> ... <isfile name="/css/CSS_File3.css"/> </isfilebundle> ...
When the file content changes, the date of the last modification changes too. So the URL will be updated and the web browser can check for the modified files.
Note
This feature is available from Intershop 7.6.
The CSSCompressor compresses all CSS file to one file and removes all white-spaces during the process.
You can turn it off via the property intershop.css.compress.enabled=false
if you have problems with compressing CSS with arithmetics. See also IS-26670 - YUICompressor generates incorrect css.
It is enabled by default.
The <ISRENDER>
tag provides the attribute File
. This attribute is an instance of an implementation from interface com.intershop.beehive.core.capi.resource.Resource.
The File
attribute supports the attributes Name
and lastModified
. Name
is the relative path and lastModified
is date of the last modification of the target file.
File:Name
The name of the bundle or the name of one of the configured files.
File:lastModified
The last date of modification.