diff --git a/less.wysiwyg.inc b/less.wysiwyg.inc
index ab75411..8651c0e 100644
--- a/less.wysiwyg.inc
+++ b/less.wysiwyg.inc
@@ -71,3 +71,37 @@ function less_wysiwyg_editor_settings_alter(&$settings, $context) {
 function less_form_wysiwyg_profile_form_alter(&$form, $form_state, $form_id) {
   $form['css']['css_path']['#description'] .= '<br />' . t('You may enter a path to a LESS file and it will be parsed automatically.');
 }
+
+/**
+ * Implements hook_ckeditor_settings_alter().
+ * Check the contentsCss CKEDITOR setting for LESS files and replace with 
+ * generated CSS files where necessary.
+ */
+function less_ckeditor_settings_alter(&$settings) {
+  $stylesheets = $settings['contentsCss'];
+
+  if (!empty($stylesheets)) {
+    $styles = array(
+      '#items' => array(),
+    );
+
+    foreach ($stylesheets as $stylesheet) {
+      $stylesheet = preg_replace('/\?.*/', '', $stylesheet);
+      $styles['#items'][$stylesheet] = array(
+        // Paths are expected to be relative to DRUPAL_ROOT.
+        'data' => trim($stylesheet, '/'),
+      );
+    }
+    $styles = _less_pre_render($styles);
+
+    $processed_stylesheets = array();
+
+    foreach ($styles['#items'] as $file) {
+      $processed_stylesheets[] = file_create_url($file['data']);
+    }
+
+    $settings['contentsCss'] = $processed_stylesheets;
+  }
+
+  return $settings;
+}
