<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>css压缩 - 漩窝 - PHP,Wordpress优化</title>
	<atom:link href="https://tucao.org/archives/tag/css%e5%8e%8b%e7%bc%a9/feed" rel="self" type="application/rss+xml" />
	<link>https://tucao.org</link>
	<description>優子的吐槽小窝</description>
	<lastBuildDate>Fri, 01 Oct 2010 15:34:12 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>
	<item>
		<title>在Win主机[或不支持mod.deflate.c]的主机上压缩CSS和JS</title>
		<link>https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html</link>
					<comments>https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html#comments</comments>
		
		<dc:creator><![CDATA[雨宫优子]]></dc:creator>
		<pubDate>Sat, 19 Jun 2010 03:06:25 +0000</pubDate>
				<category><![CDATA[杂七杂八]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css压缩]]></category>
		<category><![CDATA[css压缩工具]]></category>
		<category><![CDATA[css在线压缩]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[js压缩]]></category>
		<category><![CDATA[mod.deflate.c]]></category>
		<guid isPermaLink="false">http://xuanwobbs.com.cn/?p=342</guid>

					<description><![CDATA[<p>嘛。。。。以前a猫写了篇优化网站网页速度，让Wordpress快起来，其中有提到用htaccess来使css和 [&#8230;]</p>
<p>The post <a href="https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html">在Win主机[或不支持mod.deflate.c]的主机上压缩CSS和JS</a> first appeared on <a href="https://tucao.org">漩窝</a>.</p><p><a rel="bookmark" href="https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html" target="_blank">查看全文</a></p>]]></description>
										<content:encoded><![CDATA[<p>嘛。。。。以前a猫写了篇<a href="../archives/2010-04/speed-up-website.html" rel="bookmark">优化网站网页速度，让Wordpress快起来</a>，其中有提到用htaccess来使css和js也使用Gzip压缩</p>
<p>但是优子发现，Linux主机也有不支持mod.deflate.c或者貌似支持但无法使用的主机的样子呢【比如现在这个啦】</p>
<p>那是不是意味着无法为CSS和JS压缩了呢，当然不是，不过只能请PHP帮忙压缩啦</p>
<p>首先推荐两个插件&mdash;&mdash;Autoptimize和Scripts Gzip</p>
<p><span id="more-342"></span></p>
<p>推荐先安装前者，看看运气好不好呢，将CSS和JS的优化选项都打开。如果页面正常，FF烧虫子和IE都没提示脚本错误，恭喜你啦，不用折腾了呢</p>
<p>不过这种情况毕竟少见呢&#8230;多数情况是页面不正常了&#8230;因为Autoptimize会把所有的JS放到页尾去了，这样会使浏览器加载页面前面部分时找不到JS。也会把统计的文字显示在页面外面的样子。</p>
<p>这时先把Autoptimize的JS优化选项关闭，安装另外一个插件Scripts Gzip&#8230;.不过默认Scripts Gzip也是会压缩CSS的，功能会冲突呢。我手动删掉了CSS的部分，把不会压缩CSS的版本提供给大家啦</p>
<p><a href="http://tucao.org/wp-content/uploads/scripts_gzip.rar">下载点我<br />
	</a></p>
<p>不过为了安全起见，还是希望大家在后台手动修改相关文件，把PHP里的内容复制过去呢。要不然我又搞错哪里就很糟糕啦</p>
<p>不过还是很容易出错的样子呢，特别是用了jQuery之类的外挂库的，这个插件正好是Autoptimize的反面极端，会把JS放到&lt;head&gt;标签之后去呢，想必大家也不会把jQuery库放到&lt;head&gt;标签之前去啦，这样JS就会调用不到jQuery库呢，因此我就提供一个修改版本啦</p>
<p><a href="http://tucao.org/wp-content/uploads/scripts_gzip-change.rar">下载再次点我<br />
	</a></p>
<p>这个版本是把JS放到&lt;/head&gt;标签之后啦，因此应该不会错了呢&#8230;</p>
<p>呜哇&#8230;还有错&#8230;？那就没办法啦&#8230;按照下面的步骤来吧&#8230;</p>
<p>查看页面源代码，找到scripts-gzip/gzip.php?js=，把他所在的script标签里的内容复制下来</p>
<p>就是类似这样的啦：</p>
<blockquote>
<p>&lt;script type=&quot;text/javascript&quot; src=&quot;http://你的域名/wp-content/plugins/scripts-gzip/gzip.php?js=****&quot;&gt;&lt;/script&gt;</p>
</blockquote>
<p>然后禁用掉插件，编辑模板，在合适的地方放下这个语句呢</p>
<p>合适的地方是指，要在有调用到这些script的地方之前，在jQuery之类的外挂库之后的地方啦</p>
<p>然后就只能去编辑插件，把那些插件输出script的句子全部删除掉呢&#8230;</p>
<p>很麻烦，不过小女也无能为力啦，我就是这么做的呢&#8230;呜呜&#8230;..</p><p>The post <a href="https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html">在Win主机[或不支持mod.deflate.c]的主机上压缩CSS和JS</a> first appeared on <a href="https://tucao.org">漩窝</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://tucao.org/archives/2010-06/win-css-js-gzip-htaccess.html/feed</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

使用页面缓存Disk: Enhanced 
Minified using Disk

Served from: tucao.org @ 2026-12-05 09:38:01 by W3 Total Cache
-->