Rewrite Style Sheet

The Rewrite Style Sheet step action is to be used in conjunction with the Rewrite Page step action. It rewrites all of the URLs found in a style sheet according to a user-specified transformation and additionally converts them so that they are relative to the style sheet URL.

The Rewrite Style Sheet step action is intended to be applied on the URLs of the external style sheets found by the Rewrite Page step action. It is important that the URL transformation (specified by a list of data converters) of these two step actions are the same.

Note Execution of this step is controlled by the license key.

Properties

Style Sheet URL

The URL of the style sheet to load. If acquired from the output of a Rewrite Page step action, this is found in the originalURL property of an extracted URL of type STYLESHEET.

Data Converters

The data converters that specify the transformation to perform on the URLs of the page. This can be used to specify the transformation from URL to a location in the file system. The data converters should output an absolute URL (which may be a file URL), that the step action will then automatically convert to a URL that is relative to the original page URL. For advanced URL rewriting, we recommend the Convert Using JavaScript data converter. As mentioned above, it is important that the data converters transform URLs in the same way as the Rewrite Page step action that outputted the style sheet URL.

Output

The variable in which to store the rewritten style sheet.

URLs

The variable in which to store the extracted URLs. The step action will extract the URLs of all images and imported style sheets directly referenced by the loaded style sheet. Note that the imported style sheets may themselves contain URLs; these are not included in the list.

The URLs are outputted in JSON format, giving both the original URL as well as the absolute rewritten URL of each URL. Also, the type of URL is given, which is determined by the context in which the URL occurs - for instance, all URLs found in import statements are marked with type STYLESHEET.

The available types are:

IMAGE

An image.

STYLESHEET

An imported CSS style sheet.

To load the JSON output into a window, use the Open Variable step action with the name of the variable containing the JSON as its source of content. In the Options of the step, you may need to explicitly specify that the content type is JSON and that the encoding is UTF-8.

Options

The robot's loading options can be overridden with the step's own options. An option that is marked with an asterisk in the Options window will override the one from the robot's configuration. All other options will be the same as specified for the robot.