Manage CSS from MODX


I'm using a modification of cssSweet to manage the site's CSS, based on Donald Atkinson's RO.IDEs concept of using MDOX resources as a development environment.

Stylesheet Context resources

  1. Install Ace editor
  2. Create a Stylesheet template (for TVs as CSS variables) - should be empty.
  3. Create a Context "stylesheet" with these context settings
    default_content_type (site) - 4 (text/css)
    default_template (site) - ?
    publish_default (site) - Yes
    search_default (site) - No (need to set specifically to No)
    cache_default (site) - No (need to set specifically to No)
    syncsite_default (caching) - No (need to set specifically to No)
    richtext_default (manager) - No (need to set specifically to No)
  4. Set up ClientConfig with a few categories, such as "Colors" and create various background, text and border color settings.

    ClientConfig Color Settings

  5. Install and configure cssSweet - create a new saveContextCSS plugin from this gist, using the OnDocFormSave system event, and with these properties:
    csss.context_key (stylesheet)
    csss.custom_css_filename (style.css)
    csss.custom_css_path ([[++assets_path]]theme/themename/css/ - to use [[++assets_path]] check the "Pre-process tags in Property Values" box)
    csss.minify_custom_css (yes)
    csss.strip_css_comment_blocks (yes)
    Pre-process tags in Property Values - checked

Disable the default cssSweet plugins, unless you want to also use them.

Susan Ottwell
April 2017