function advagg_build_js_bundle in Advanced CSS/JS Aggregation 7
Same name and namespace in other branches
- 6 advagg.module \advagg_build_js_bundle()
Given a list of files, grab their contents and glue it into one big string.
Parameters
$files: array of filenames.
Return value
string containing all the files.
2 calls to advagg_build_js_bundle()
- advagg_css_js_file_builder in ./
advagg.module - Aggregate CSS/JS files, putting them in the files directory.
- advagg_js_compress_prep in advagg_js_compress/
advagg_js_compress.module - Compress a JS string
File
- ./
advagg.module, line 2400 - Advanced CSS/JS aggregation module
Code
function advagg_build_js_bundle($files) {
if (empty($files)) {
return '';
}
$data = '';
// Build aggregate JS file.
foreach ($files as $file) {
// Append a ';' and a newline after each JS file to prevent them from running together.
if (advagg_file_exists($file)) {
$data .= file_get_contents($file) . ";\n";
}
}
return $data;
}