<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: css code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 12 Oct 2008 02:02:57 GMT</pubDate>
    <description>DZone Snippets: css code</description>
    <item>
      <title>PHP-function to optimize a CSS-file</title>
      <link>http://snippets.dzone.com/posts/show/4137</link>
      <description>&lt;code&gt;&lt;br /&gt;	/**&lt;br /&gt;	 * Converts a CSS-file contents into one string&lt;br /&gt;	 *&lt;br /&gt;	 * @param    string  $t Text data&lt;br /&gt;	 * @param    int     $is_debug Skip convertion&lt;br /&gt;	 * @return   string  Optimized string&lt;br /&gt;	 */&lt;br /&gt;	function text_smooth_css($t, $is_debug = 0)&lt;br /&gt;	{&lt;br /&gt;		if ($is_debug) { return $t; }&lt;br /&gt;		/* Remove comments */&lt;br /&gt;		$t = preg_replace("/\/\*(.*?)\*\//s", ' ', $t);&lt;br /&gt;		/* Remove new lines, spaces */&lt;br /&gt;		$t = preg_replace("/(\s{2,}|[\r\n|\n|\t|\r])/", ' ', $t);&lt;br /&gt;		/* Join rules */&lt;br /&gt;		$t = preg_replace('/([,|;|:|{|}]) /', '\\1', $t);&lt;br /&gt;		$t = str_replace(' {', '{', $t);&lt;br /&gt;		/* Remove ; for the last attribute */&lt;br /&gt;		$t = str_replace(';}', '}', $t);&lt;br /&gt;		$t = str_replace(' }', '}', $t);&lt;br /&gt;		return $t;&lt;br /&gt;	}&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 13 Jun 2007 13:42:52 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4137</guid>
      <author>Dmitry-Sh (Dmitry Shilnikov)</author>
    </item>
  </channel>
</rss>
