Rather than having several calls to several CSS, it is better for your visitors
to have only one stylesheet. This speeds up load times, allows a more efficient cache management.
But for developing the CSS, it is often preferable to manage multiple
specific files, specialized (one for reset, one for print version, another for small screens, etc..)
The purpose of this plugin is to allow you to work with various files, but merge them into
one single file when the browser need it.
It can be generate each time (during development) or use a cache-file when finished.
It will optimize the CSS by removing all unnecessary characters that increase the
CSS (tabs, spaces, line breaks …).
All comments will be deleted – but you can insert a few lines at the top, to specify such a
Author: Richard Carlier
Plugin URI: rc_CSS
Thanks: Mathieu Bouillot (The idea of this plugin came after discussion with him …)
Donate: Not for me, but for French Multiple Sclerosis Society, or equivalent…
rc_css/ directory to the
Activate the plugin through the
Plugins menu in WordPress
Place all your CSS in your theme directory (as usual) including style.css with WordPress comments.
Create an empty file called rc_css_style.css in this directory (or copy the one included),
and put 0666 permission (PHP need to rewrite this file).
header.php, replace (for example):
<link rel="stylesheet" href="/reset.css” type=”text/css” />
<link rel="stylesheet" href="/print.css” type=”text/css” media=”print” />
<link rel="stylesheet" href="/mobile.css” type=”text/css” media=”screen and (max-width: 400px)” />
<link rel="stylesheet" href="/style.css” type=”text/css” media=”all” />
Order is important (for your CSS, as usual…). The function
rc_css_echo_style() should be at the end.
Optionnaly, you can go to “Admin” > “Appareance” > “rc_CSS – Merge and optimize CSS”
to specify comments that will be added at the top of css.
rc_css_enqueue_style( $css_filename , $css_media ); $css_filename(string) : css filename, located in wp-content/themes/YOURTHEME/ $css_media(string)(optional) : media query ( see http://www.w3.org/TR/css3-mediaqueries/ ) or all by default rc_css_echo_style( $generate ); $generate (boolean)(optional) : create file (1/True) or use existing file (0/False) - during development => true - for exploitation => false (or nothing) - if true, it's create a file wp-content/themes/YOURTHEME/rc_css_style.css
FATAL ERROR ?
- Verify than your rc_css_style.css is located in you theme directory.
- Verify the chmod of it (0666 – need to be writable).
Contributors & Developers
“rc-CSS” is open source software. The following people have contributed to this plugin.Contributors
1.0 – This is version 1…