--- a/less/less.module
+++ b/less/less.module
@@ -79,13 +79,33 @@
         return;
       }
 
-      $output_file = $css_path . '/' . basename($input_file, '.less');
+      // Parse any passed variables/functions/expirations:
+      $less_args = array(
+        'expire' => false,
+        'tag' => '',
+        'functions' => array(),
+        'variables' => array(),
+      );
+      if (isset($info['less'])) {
+        $info['less'] = (array) $info['less'] + $less_args;
+        $less_args['expire'] = (bool) $info['less']['expire'];
+        // Could do some sanitizing here since 'tag' hits the filesystem, but
+        // that is unlike any other module.  If a bad module/theme coder wants
+        // to hurt the filesystem, no check here will prevent them anyway;
+        // The onus is thus on any implementer to prevent bad user input from
+        // getting this far.
+        $less_args['tag'] = trim($info['less']['tag']);
+        $less_args['functions'] = (array) $info['less']['functions'];
+        $less_args['variables'] = (array) $info['less']['variables'];
+      }
+
+      $output_file = $css_path . '/' . basename($less_args['tag'].$input_file, '.less');
       // correct file names of files not following the .css.less naming convention
       if (drupal_substr($output_file, -4) != '.css') {
         $output_file .= '.css';
       }
 
-      if (!file_exists($output_file)) {
+      if (!file_exists($output_file) || $less_args['expire']) {
         require_once($lessphp_include);
 
         $less = new lessc();
@@ -107,7 +127,12 @@
         $data = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $contents);
 
         try {
-          $output_data = $less->parse($data);
+          // Register any PHP functions (THIS CAN BE VERY DANGEROUS, SINCE IT GIVES CSS ACCESS TO PHP FUNCTIONALITY!):
+          foreach ($less_args['functions'] as $less_func => $php_func) {
+            // Don't typecast $php_func, since as of PHP 5.3 it may be an anonymous function instead of a string.
+            $less->registerFunction(trim($less_func), $php_func);
+          }
+          $output_data = $less->parse($data, $less_args['variables']);
           file_unmanaged_save_data($output_data, $output_file, FILE_EXISTS_REPLACE);
         }
         catch (Exception $e) {
