Module Monday: Code Per Node

Module Monday: Code Per Node



Back in the Drupal 6 days, I released the CSS Injector to help site admins drop simple CSS rules onto site pages without hacking up the actual theme. It was a bit controversial, as it blurred the lines between “theme” and “module” responsibilities, but it was handy for the quick-and-dirty overrides that are common on many sites.
The Code Per Node module goes a step further: it lets users with sufficient permissions add custom CSS rules and snippets of Javascript to any node on the site. While some designers are probably horrified (not without reason), it’s a godsend for squeezing quick tweaks into custom pages or articles that need just a little extra something.
Screenshot of philosophically questionable custom CSS
Code Per Node allows admins to control which content types allow custom CSS, which ones allow custom JavaScript, and which user roles are allowed to use either of those features. The Drupal 7 version of the module, just released, also allows administrators to specify default chunks of CSS and JS to be added to all nodes of a given content type.

Leave a Reply

Your email address will not be published. Required fields are marked *