Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从主题[Drupal 7]中删除所有js和css_Drupal_Drupal 7 - Fatal编程技术网

从主题[Drupal 7]中删除所有js和css

从主题[Drupal 7]中删除所有js和css,drupal,drupal-7,Drupal,Drupal 7,在html.tpl.php中,我有两个变量:$style和$scripts 但它们不会通过模板功能重置: function MYTHEME_preprocess_html(&$vars) { $vars['styles'] = null; $vars['scripts'] = null; } 如何重置此变量?解决方案: function MYTHEME_preprocess_html(&$vars) { # Reset CSS and JS drup

在html.tpl.php中,我有两个变量:$style和$scripts

但它们不会通过模板功能重置:

function MYTHEME_preprocess_html(&$vars) {
   $vars['styles'] = null;
   $vars['scripts'] = null;
}
如何重置此变量?

解决方案:

function MYTHEME_preprocess_html(&$vars) {
    # Reset CSS and JS
    drupal_static_reset('drupal_add_css');
    drupal_static_reset('drupal_add_js');
}

如果要删除这两个变量的所有数据集,可以使用*template\u process\u html()*钩子,该钩子在*template\u preprocess\u html()*之后调用

函数MYTHEME\u process\u html(&$vars)
{
$vars['style']=null;
$vars['scripts']=null;
}

此游戏出现jQuery未找到错误

drupal_static_reset('drupal_add_js');
我通过以下方式成功删除了所有js:

function TEMPLATE_js_alter(&$js){
    unset($js['misc/jquery.once.js']);
    unset($js['misc/jquery.js']);
    unset($js['misc/drupal.js']);
    unset($js['settings']);
}