Inline @import to Link


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

ModPagespeedEnableFilters inline_import_to_link
pagespeed EnableFilters inline_import_to_link;
in the configuration file.


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.


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(;</style>

Then PageSpeed will convert it to:

<link type="text/css" media="screen" rel="stylesheet" href=""/>


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


This filter is considered minimal risk.