This plugin hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

rc-CSS

Description

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
copyright …

Credits

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…

Screenshots

  • header.php, before/after using rc_css plugin
  • example (excerpt) of rc_css generated.css stylesheet (no indentation, no comment, @media...)
  • option screen...

Installation

Upload rc_css/ directory to the /wp-content/plugins/ directory

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.

Generaly:
wp-content/themes/YOURTHEME/style.css
wp-content/themes/YOURTHEME/reset.css
wp-content/themes/YOURTHEME/print.css
wp-content/themes/YOURTHEME/mobile.css
wp-content/themes/YOURTHEME/imgs/background.png

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).

In your 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” />

by:

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.

Codex

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

FAQ

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

Translate “rc-CSS” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

1.0 – This is version 1…