Drupal callback :: Less CSS file with variable_get()'s I am trying to create a custom module that programmatically creates a LESS file.

I created a menu callback that is a file. Here is hook_menu()...

$items['sites/all/themes/universal/less/dynamic.css.less'] = array(
  'page callback' =&gt; 'jobs_universal_lessvars',
  'access arguments' =&gt; array('access content'),
  'type' =&gt; MENU_CALLBACK
);


Here is the callback.

function jobs_universal_lessvars(){ 
  header('Content-type: text/css');
  $output = '
    @color: #4D926F;
    body.notaclass {
      color:@color;
    }
  ';
  print $output;
}


And I call this to add it.

function universal_preprocess_html(&amp;$variables) {
  drupal_add_css(drupal_get_path('theme','universal').'/less/dynamic.css.less');
}


I uploaded a static file to the above ^^ path, disabled the menu callback, and it processed/applied correctly. When I try to run this module, it's not included and I get an error saying


  LESS error: load error: failed to find
  sites/all/themes/universal/less/dynamic.css.less


Before you answer...


I have the LESS module installed
I have the LESS library uploaded correctly
I have tested that I can include a static .less file and have it process
I have tested the menu callback by manually going to the URL
I have tried it with and without calling header('Content-type: text/css');


I get it... it's not a file. But it "is", right? I could just call this function and have it create a new CSS file that's added, but it doesn't fulfil the requirements of the module. Help me? :) Programmatically creating files is very new to me!
It may appear like a file to the browser if you were to directly request that path in the browser, but drupal_add_css() and the LESS module deal with the file system directly and does not attempt to resolve file paths through Drupal's menu system.

drupal_add_css() will not add files that do not exist on the file system.

If you are attempting to have programmatically assigned variables within a .less file I would suggest checking out the Variables functionality that is available within the latest version of the LESS CSS Preprocessor module, documentation here: https://drupal.org/node/2139603

If you are truly trying to create a dynamically composed .less file, you first need to create the file in the files directory of the drupal install and then add that file with drupal_add_css().