LESS is a preprocessor for CSS that will allow you to use variables and math (and some other stuff) in your CSS so that you only have to declare values once. According to their docs:
This module will automatically process any LESS files that are added using
drupal_add_cssor added through your theme's .info file.
Mime Mail also uses that function (line 48, mimemail.theme.inc, 6.x-1.1), but it doesn't seem to serve up the cached, preprocessed files. Instead it serves the raw files that can potentially break your email.
If you use the LESS module in your site, Mime Mail will include the contents of .less files in your email template without running them through the preprocessor first.
Here's my temporary (probably permanent) fix in template.php for posterity:
function THEMEHOOK_preprocess_mimemail_message(&$variables) {
if(module_exists('less') && function_exists('_less_inc_path')) {
require _less_inc_path();
//can't use path_to_theme() because for some reason it gives the module
//path instead of the theme path.
global $theme;
$path = drupal_get_path('theme', $theme) . '/styles/mail.css.less';
$less = new lessc();
//overwrite the css variable for the tpl.
$variables['css'] = $less->compileFile($path);
}
}
Comments
Comment #1
jamix commented+1 for this. Proper CSS preprocessing will also fix the problem of making paths absolute in snippets like this one (at least in Drupal 7):
Comment #2
tr commentedAs D6 is not longer supported, I'm closing this issue in favor of the one we have open for D7. See #2844299: Incorrectly includes unprocessed sass,less,scss etc