Write CSS parts to disk; used when CSS selectors in one file is > 4096.
Parameters
string $css: CSS data to write to disk.
int $overall_split: Running count of what selector we are from the original file.
array $file_info: File info array.
Return value
string Saved path; FALSE on failure.
1 call to Files::createSubfile()
- Files::splitCssFile in src/
State/ Files.php - Given a file info array it will split the file up.
File
-
src/
State/ Files.php, line 514
Class
- Files
- Provides AdvAgg with a file status state system using a key value store.
Namespace
Drupal\advagg\StateCode
private function createSubfile($css, $overall_split, array &$file_info) {
// Get the path from $file_info['data'].
$file = advagg_get_relative_path($file_info['data']);
if (!file_exists($file) || is_dir($file)) {
return FALSE;
}
// Write the current chunk of the CSS into a file.
$path = $this->partsPath . $file . $overall_split . '.css';
$directory = dirname($path);
file_prepare_directory($directory, FILE_CREATE_DIRECTORY);
file_unmanaged_save_data($css, $path, FILE_EXISTS_REPLACE);
if (!file_exists($path)) {
return FALSE;
}
return $path;
}