I'm almost sure this is a mad idea but I'd like people's opinions as to its viability.

I've got a custom AdaptiveTheme sub-theme and am using SASS with the Sassy + Prepro modules + PHPSass library to recompile the SASS to CSS on cache clear.

For non-technical site builders I like the user-friendliness of the color module that is used in some of the other AT sub-themes but I imagine it'd be difficult to get the color module and SASS working together in a way that made sense conceptually (i.e. that didn't create a development / maintenance nightmare).

So, I thought it should be possible in my sub-theme to create some extra theme settings for base colors etc (without having to use the color module) that, on settings save, get written to the SASS color variables in my "_custom.scss" file then trigger a clear cache so that the SASS is recompiled to CSS.

It sounds like it could work, but I'm not sure how mad it is, or if it is viable, where to start. Maybe someone has done it before even.

Any feedback appreciated.

EDIT: Further idea. Could fork and rename the color module just to provide the (familiar) user interface and customisable color palettes and make it write color variables to SASS file instead. Color module's real-time preview could be dumped as full computed palette wouldn't be available until SASS compilation anyway. Likewise all the image / gradient generation and slicing functions could be removed.

Comments

inteja’s picture

Issue summary: View changes

Added more info.

inders’s picture

I would like to give this a try.. I am playing with foundation theme currently and will try to get few patches.

inders’s picture

Somehow got it working in a a foundation based theme :-) a bit hack .. but works...


/**
 * @desc chek if site specific file was generated and replace default loaded file.
 * @param type $css
 */
function himsky_css_alter(&$css) {
  if (isset($css[path_to_theme() . '/css/himsky.css'])) {
    $site_css_url = 'public://sass/himsky.css';
    if (file_exists($site_css_url)) {
      if ($wrapper = file_stream_wrapper_get_instance_by_uri($site_css_url)) {
        $file_url = $wrapper->getDirectoryPath() . '/sass/himsky.css';
        $css[path_to_theme() . '/css/himsky.css']['data'] = $file_url;
      }
    }
  }
}

- Using shell_exec() for compiling scss files so not sharing code for security reasons.

Hope this will be helpful for others..

Thank you !
-Inder Singh
http://indersingh.com