JCSS Insert rules administration/overview page
JCSS Insert loaded rules block
JCSS Insert quick edit form

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Allows site builders and themers to insert custom CSS or Javascript into the page output based on configurable rules, it also gives the option to override theme style-sheets and JavaScript. It's useful for adding simple CSS tweaks without modifying a site's theme every time, it helps users with proper permissions to quickly apply their CSS/JS additions using the admin interface especially when displaying and theming the output of Views or a Panel page.

WARNING: This module will allow users with proper permissions to insert arbitrary CSS or Javascript code into the page which is considered dangerous from security point of view and may lead to web attacks if the individual who is given the permissions is not trusted, the use of this module is considered useful only in development stage, all the modifications this module allows to the site interface should be placed in a separated module or in the theme on production websites.

The CSS files and JS files are added using Drupal's standard drupal_add_css() and drupal_add_js() functions respectively, so CSS/JS aggregation is handled as usual.

The module provides an option for rules to be loaded as *Theme* rules, themes' CSS/JS files are loaded after all modules CSS/JS files, further more, when a *theme* rule defined by this module is loaded into the page, it will be loaded *AFTER* the current theme's CSS/JS files, allowing the module admin to override current themes' style-sheets and JavaScript.

This module is not a replacement for full-fledged theming, but it provides site administrators with a quick and easy way of tweaking things without diving into full-fledged theme hacking.

Features:

  • Works well with CSS/JS aggregators, like Advanced CSS/JS Aggregation (advagg).
  • Has a quick edit feature for changing the CSS/JS code definition using semi-Ajax interface (may add full-Ajax in the future), this feature works with block integration.
  • Support for weighted rules, admin can change the weight of rules to control their load order.
  • Admin can disable certain rules without deleting or commenting their code out.
  • Rules may be loaded conditionally by pages, so for certain paths or path wildcards a rule may be set to be 'active' or 'inactive' (similar to core block module's visibility).
  • The CSS/JS code of a rule may optionally be parsed by PHP parser, and the output of the code evaluation will be the actual CSS or JS code to load into the page.
  • For JavaScript rules, supports choosing the scope ('header' or 'footer') and supports 'inline' JavaScript.
  • Any CSS/JS rule can be chosen not to be 'preprocessed' by Drupal, skipping the aggregation (if enabled) for it.
  • Can override theme's Style-sheets and JavaScript.

Similar modules

CSS Injector
JS injector

They both allow loading additional CSS or JS by rules, but they both does not provide an option to override theme CSS/JS for Drupal 6 version at least.

This module adds a quick edit interface and block support over those two inspirational modules, beside, it supports RTL CSS.

Project information

  • Created by dimsh on , updated