-
Notifications
You must be signed in to change notification settings - Fork 1
API To URL
Minify and combine the content of the files (and the files in the groups) in "filesOrGroups"
This method is supported by both minify tools: $jsMinifyTool.toUrl() & $cssMinifyTool.toUrl()
and has a few alternative signatures as you can see below. They all do the same thing, but the shorter ones use defaults for some of the attributes for convenience.
.toUrl(filesOrGroups)
.toUrl(filesOrGroups, host)
.toUrl(filesOrGroups, domain)
.toUrl(filesOrGroups, domain, host)
Field | Type | Description |
---|---|---|
filesOrGroups required |
String | A comma separated list of file paths, or groups. |
domain optional |
String | The domain that should be used as the domain for the minifier URL. If no domain is provided the URL will be made relative. Setting this does not mean that the files in filesOrGroups will be retrieved from that server and minified, it just means that the domain of the generated Minify URL will point to that server. (For security reasons the Minifier does not load and minify files that are not located on one of the hosts of this dotCMS instance.). Setting this parameter is useful for things like using CDNs to host your content. Use null or "" to skip this parameter. |
host optional |
com.dotmarketing.beans.Host | The host where the given files can be found. Use null to skip this parameter. |
Returns The URL that can be called by the browser that will return a minified and combined version of the content of the files (and the files in the groups) in "filesOrGroups". The URL that is returned consists out of these parts:
[domain]/[path]/[cache buster][FILTER_PATTERN][extension]?uris=[uris][debug mode]
- [domain]
If the parameter "domain" is provided, [domain] will be constructed as a protocol relative domain: "//[the value of the provided domain]". If not, the [domain] part will be "/" making the URL relative to the root of the website.
- [path]
The path will be constructed by taking the path of the first file in "filesOrGroups" and stripping away the file part. This means that all other files in "filesOrGroups" will have to be written in such as way that references to other resources from the content of those files are relative to that same path. For instance all references to background images in CSS files must be relative to the same path, or else they won't be found.
- [cache buster]
This is the result of an Adler32 checksum of all the modification dates of all the files included in filesOrGroups. If one of the files changes its modification date, this checksum will also change, resulting in a different URL, forcing the browser to reload. We do not use a http query parameter for this because some proxies don't included them in their cache key.
- [FILTER_PATTERN]
The value of "FILTER_PATTERN" as defined in this class. It is used by the Minify filter to recognize which requests the Minify frameworks needs to handle. So never use this pattern in any of your own .css or .js files because the minifier will handle it as a minifier servlet
- [extension]
The extension of the type of files that are being minified, e.g. css or js.
- [uris]
The list of all files in "filesOrGroups"separated by commas. The groups are of course translated to the files that contains them.
- [debug mode]
If in debug mode [debug mode] will be "&debug=true", otherwise it is empty. Requesting the URL the server will respond with the original version of the files in [uris], not the minified versions. The files will still be combined into one big file by the server, just not minified. We are in debug mode if the URL that was used to do this request has a parameter with the name "debug", so the value of that parameter does not really matter.