Experimental project

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

About this modules

CSS Fields is a simple module that provides a custom field type called "CSS." CSS Fields allows you to use CSS very easily for individual nodes by implementing the core function drupal_add_css() while allowing you to keep semantically clean and stable WYSIWYG content. It adds the CSS to the <head> of your HTML document so that you can follow W3C standards without sacrificing your workflow.

One of the major benefits of this module is that it makes it much easier if you have minor tweaks here and there for layout of a specific page. If you need tweak your theme on a per-node basis, this module is for you. It's also beneficial for developers that have several steps to push code to a production environment. Critics would say that the process exists for a reason, but if you plan to adjust the margin on one or several <div;gt;s for only one page and maybe only temporarily, those steps may render themselves unnecessary. This module will help to speed up workflow. If you don't abuse it, CSS Fields will be useful without being counter-productive.

This module currently provides one field type - CSS - and two widgets - CSS Snippet and CSS File.

CSS Snippet

This widget provides a plain textarea where you are able to input any CSS. It adds your styles to the <head> of your HTML document in an inline format.

Benefits:

  • Version tracking using node revisions in non-version control environments
  • Styles for individual nodes
  • No need to wrap your CSS in <style> tags
  • Saves code that would otherwise clutter your theme CSS files
  • Keeps your site standards-compliant
  • Speeds up workflow

Downsides:

  • Inline CSS in Drupal is not subject to compression and aggregation. It will not benefit from core caching features like if you put your code in a theme css file.

CSS File

This widget will provide a text area for you to link to a CSS file on your server. Future versions of this module will provide file management in Drupal's media library.

Benefits:

  • Will be cached and aggregated depending on your performance settings.
  • Ability to include node or content specific stylesheets without having to write long arduous CSS selectors or use other modules.

Currently there is no way to validate your CSS prior to saving a node or attaching the file to your node. Use at your own risk, and be sure you know what you're doing. See the roadmap for more information.

Roadmap

In no particular order:

  • CSS files will be manageable through the Form API managed_file field type, allowing you to upload and select your CSS file without having to use FTP. Eventually this will evolve into utilizing the media module
  • CSS validation for the CSS Snippet widget before saving your node.

If you are interested in co-maintaining this module, please let me know.

Project information

  • caution Seeking co-maintainer(s)
    Maintainers are looking for help reviewing issues.
  • Created by scott.allison on , updated