function browsersync_css_alter in Browsersync 7
Same name and namespace in other branches
- 8.2 browsersync.module \browsersync_css_alter()
- 8 browsersync.module \browsersync_css_alter()
Implements hook_css_alter().
Browsersync does not work with CSS import so we need to force Drupal to embed CSS files as <link> elements.
@link https://github.com/shakyShane/browser-sync/issues/10
File
- ./
browsersync.module, line 58 - Code for the Browsersync module.
Code
function browsersync_css_alter(&$css) {
if (browsersync_get_setting('enabled', FALSE) && !variable_get('preprocess_css')) {
foreach ($css as $key => $value) {
// Skip core files.
$is_core = strpos($value['data'], 'misc/') === 0 || strpos($value['data'], 'modules/') === 0;
if (!$is_core && file_exists($value['data'])) {
$css[$key]['preprocess'] = FALSE;
}
}
}
}