"Fossies" - the Fresh Open Source Software Archive

Member "incubator-pagespeed-mod-1.14.36.1/html/doc/filter-css-inline-import.html" (28 Feb 2020, 4297 Bytes) of package /linux/www/apache_httpd_modules/incubator-pagespeed-mod-1.14.36.1.tar.gz:


Caution: In this restricted "Fossies" environment the current HTML page may not be correctly presentated and may have some non-functional links. You can here alternatively try to browse the pure source code or just view or download the uninterpreted raw source code. If the rendering is insufficient you may try to find and view the page on the incubator-pagespeed-mod-1.14.36.1.tar.gz project site itself.

Inline @import to Link

Configuration

The 'Inline @import to Link' filter is enabled by specifying:

Apache:
ModPagespeedEnableFilters inline_import_to_link
Nginx:
pagespeed EnableFilters inline_import_to_link;
in the configuration file.

Description

The "Inline @import to Link" filter converts a <style> tag consisting of only @import statements into the corresponding <link> tags. This conversion does not itself result in any significant optimization, rather its value lies in that it enables optimization of the linked-to CSS files by later filters, in particular the combine_css, rewrite_css, inline_css, and extend_cache filters.

Operation

This filter inspects the contents of all <style> tags and converts the tag if all the following conditions are met:

If all these conditions are met, the <style> tag and its contents are replaced with a <link> tag for each @import, with:

For example, if the <style> tag looks like this:

<style type="text/css" media="screen">@import url(http://www.example.com/style.css);</style>

Then PageSpeed will convert it to:

<link type="text/css" media="screen" rel="stylesheet" href="http://www.example.com/style.css"/>

Example

You can see the filter in action at www.modpagespeed.com on this example.

Risks

This filter is considered minimal risk.