function _less_output_path in Less CSS Preprocessor 7.4
Same name and namespace in other branches
- 8 includes/less.process.inc \_less_output_path()
Determine output filename and add it to the settings array.
Parameters
array[] $item:
string $key:
1 call to _less_output_path()
- LessUnitTest::test_less_output_path in tests/
less.test - Test the _less_output_path() function.
1 string reference to '_less_output_path'
- _less_pre_render in ./
less.module - Pre-render function for 'style' elements.
File
- includes/
less.process.inc, line 53 - Contains functions related to compiling .less files.
Code
function _less_output_path(&$item, $key) {
$input_file = $item['less']['input_file'];
$less_settings = $item['less'];
// array_multisort() the data so that the hash returns the same hash regardless order of data.
array_multisort($less_settings);
$output_path_array = array(
'!less_output_dir' => LESS_DIRECTORY,
// Strip '.css' extension of filenames following the RTL extension pattern.
'!input_file_basename' => basename(basename($input_file, '.less'), '.css'),
// drupal_json_encode() is used because serialize() throws an error with lambda functions.
'!settings_hash' => drupal_hash_base64(drupal_json_encode($less_settings)),
);
$output_path = format_string('!less_output_dir/!input_file_basename.!settings_hash.css', $output_path_array);
$item['less']['output_file'] = $output_path;
}