WordPress插件:JS & CSS Script Optimizer

2016年8月15日 | 分类: 【源码】

官网:https://wordpress.org/plugins/js-css-script-optimizer/
下载:https://downloads.wordpress.org/plugin/js-css-script-optimizer.zip

Make your Website faster by packing and grouping JavaScript and CSS files. Also it provides an opportunity to add CSS & JS via admin panel.

It works, but you most probably will have to play with the options to suit your needs.

Features

Grouping several scripts into single file (to minimize http requests count)
Combine several CSS files into single files (with grouping by “media”)
Pack scripts using Dean Edwards’s JavaScript Packer
Minify CSS files (remove comments, tabs, spaces, newlines)
Support conditional JS and CSS (html5.js, IE CSS, <!–[if lt IE 9]>)
Support JavaScript L10n (wp_localize_script)
Put JavaScript at bottom
Ability to include JavaScript and CSS files
Ability to change cache directory from the plugin settings (default: wp-content/cache/scripts)
Network / WPMU support

Usage Recommendations:

This Plugin processing only those scripts that are included properly (using “wp_enqueue_script” or “wp_enqueue_style” function)
Cache directory /wp-content/cache/ should be writable
Read How to properly add CSS in WordPress http://4coder.info/en/blog/2010/how-to-properly-add-css-in-wordpress/
If any script fails and web-browser console shows errors you can add this JS to exclude list

同类插件:WP Minify

经测试,发现没起作用。不做深究。

官网:https://github.com/tangshuang/wp-minify
下载:https://github.com/tangshuang/wp-minify/archive/master.zip

官网:https://wordpress.org/plugins/wp-minify/
下载:https://downloads.wordpress.org/plugin/wp-minify.zip

参考:https://segmentfault.com/a/1190000005053993
参考:http://www.kfjuhua.net/news/wordpress-wp-minify-plugin

WP Minify 是一个使用 PHP5 开发的应用,可以帮你合并以及压缩 CSS 和 JS 文件, 通过遵循一些 YSlow 的优化规则来提高网站的性能。它会合并多个CSS 或者 JavaScript 文件,移除一些不必要的空格和注释,自动合并成两个文件(JS 和 CSS 分别一个,进行 gzip 压缩,并且会设置浏览器的缓存头。

浏览器都有单个域名并发请求数限制,所以如果一个页面中存在很多的资源,比如 CSS 和 JavaScript 文件,那么明显会降低网站的加载速度,比较好处理方式就是把多个文件通过一个请求来访问,这样既不会影响之前的文件维护,又会减少资源的清楚数 量,Minify 就是为之而生。

注意:使用该插件,要保证wp-content/plugins/wp-minify/cache目录可写

同类插件:
https://wordpress.org/plugins/js-css-script-optimizer/
https://wordpress.org/plugins/w3-total-cache/
https://wordpress.org/plugins/wp-super-cache/

Announcing Comet Cache™ (formerly ZenCache)


https://wordpress.org/plugins/autoptimize/