Converting @imports to links

Hi,

I was trying to write a script which converts the @import statements to
<link> tags. And i have two questions.
1. Can there be a @import statement and also other style statements inside
the <style> tag? For example:

<style type="text/css">
@import url(http://www.example.com/style.css);
body
{
        background:#FFF;
}
..NUI_ContentFrameHeader_l
{
  clear: both;
  height: 50px;
  margin: 0;
  color: black;
  background:url(/vpn/images/NUI_box_l.png) no-repeat left top;
  border: solid 0px #BBC6D6;
  overflow: hidden;
  letter-spacing: 0;
  padding:0 0 0 15px;
}
</style>



2. If there are more than one @import statement in the beginning of
 <style> tag body and this is not a scoped style tag. Can we convert
@import statements to <link> statements and move just above the <style>
tag? like:

<style type="text/css">
@import url(http://www.example.com/style1.css);
@import url(http://www.example.com/style2.css)
body
{
        background:#FFF;
}
..NUI_ContentFrameHeader_l
{
  clear: both;
  height: 50px;
  margin: 0;
  color: black;
  background:url(/images/NUI_box_l.png) no-repeat left top;
  border: solid 0px #BBC6D6;
  overflow: hidden;
  letter-spacing: 0;
  padding:0 0 0 15px;
}
</style>

to

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

body
{
        background:#FFF;
}
..NUI_ContentFrameHeader_l
{
  clear: both;
  height: 50px;
  margin: 0;
  color: black;
  background:url(/images/NUI_box_l.png) no-repeat left top;
  border: solid 0px #BBC6D6;
  overflow: hidden;
  letter-spacing: 0;
  padding:0 0 0 15px;
}
</style>

Thanks,
Mahesh

Received on Thursday, 7 February 2013 19:36:51 UTC