سؤال

I want to use a script to reload my CSS, but the script uses tag and Drupal uses import for including CSS (when not using aggregation on a development site).

I tried to use hook_alter_css but apparently (using dpm function) that's not the place where the import comes from. So, how can I override this behavior? Thanks!

هل كانت مفيدة؟

المحلول 2

You can also use the Link CSS module to achieve this.

Or, in your own custom module, use hook_css_alter as described here: http://e9p.net/disable-import-tags-stylesheets-while-development-drupal

/**
 *  Implements hook_css_alter().
 */ 
function mymodule_css_alter(&$css) {
  $preprocess_css = variable_get('preprocess_css', TRUE);
  if (!$preprocess_css) {
    // For each item, don't allow preprocessing to disable @import.
    foreach ($css as &$item) {
      if (file_exists($item['data'])) {
        $item['preprocess'] = FALSE;
      }
    }
  }
}

نصائح أخرى

This Happens When aggregation is turned off.There is a work around if u r using a custom theme while adding your css file in your template.php file:-

drupal_add_css(path_to_subtheme() .'/layout.css', 'theme', 'all', $preprocesstheme);
$preprocesstheme set it to  false (true aggration is turned on).

Use this method to include all css files.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top