ManageCSS

Summary: Use your pub/css/ directory to collect and manage multiple css files automatically
Version: 2021-12-01
Prerequisites: None
Status: Active
Maintainer: Kirk Siqveland
Categories: CSS, CMS
Users: (view? / edit)
Discussion: ManageCSS-Talk?

What does this recipe do?

  • Automatically add CSS to your Skin by just copying files to the /pub/css folder
  • ManageCSS compiles all of the CSS files in /pub/css to create a new local.css file, which PmWiki uses by default.

Warning: this will over-write the existing local.css so be sure you rename it if you need it (if you have it, you most certainly need it). It will also apparently include all per-page and per-group CSS files in the global local.css, effectively disabling the local customization PmWiki allows with CSS, see PmWiki:GroupCustomizations#css. It will also apparently rewrite the files in-place every time any page and any action is requested, even if there are no changes to the CSS files in the local directory.

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

Description

Easily use multiple CSS files to Manage distinct features

I like the built-in pmwiki/pub/css/local.css file as a means to manage css for my many features,
but I hate editing to be sure I remove the right code if I drop a feature, or only wanted to test something quickly.

ManageCSS.php simply reads all the .css files in the {pmwiki}/pub/css/ directory and assembles them into a new local.css file!

This way you can have separate CSS files for say a slide show, or special tables or for displaying your poetry, but keep them
in one place regardless of which skin you use.

You can now manage each file separately, using for example three files slideshow.css, specialtables.css and poetry.css
Once you have added the ManageCSS recipe, all you need to do is add or remove these files to the pmwiki/pub/css/ directory.
ManagaCSS will then automatically compile all of them into a new local.css which pmwiki loads each time a page is loaded.

Installation

- WARNING -

Save your existing local.css file if you have one you already made.
ManageCSS will wipe the existing file and assemble a new one!

To Install:
Download and save the ManageCSS.phpΔ file to your {pmwiki}/cookbook directory
Then add the following line to your {pmwiki}/local/config.php file:

include_once("$FarmD/cookbook/ManageCSS.php");

Usage

Just import or remove your CSS files from the {pmwiki}/pub/css/ directory.

If multiple CSS files manage common Elements, remember the files will be processed in alphabetical order.
That means the last one to be loaded will override things already defined by a previous file.
You may need to rename files to set the right order or pay attention to which elements you need to
manage with each file. e.g. does the SlideShow.css need to set the Font for <body>? This is where careful use of id= and class= comes in handy!

Notes

If you have future plans or wishes for this recipe.

Change log / Release notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

Cookbook /
LocalCSS  Flexible CSS compilation from a wiki page (beta)
PmWiki /
GroupCustomizations  How to customize a subset of your wiki

Contributors

Comments

See discussion at ManageCSS-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.