Drupal jQuery 依赖项引发错误 "The website encountered an unexpected error. Please try again later."
Drupal jQuery dependency throws error "The website encountered an unexpected error. Please try again later."
我是 Drupal (8) 的新手,它是模板系统。我设置了一个 themename.libraries.yml 和一个 themename.info.yml 看起来像这样:
xxx.info.yml:
name: xxx
description: theme for xxx
type: theme
core: 8.x
package: Custom
basetheme: classy
libraries:
- xxx/stylesheets
- xxx/javascript
regions:
content: Content
pagetitle: Pagetitle
searchblock: Searchblock
xxx.libraries.yml
stylesheets:
css:
theme:
css/style.css: {}
https://fonts.googleapis.com/css?family=Open+Sans: {}
https://fonts.googleapis.com/css?family=Montserrat: {}
javascript:
js:
js/site.js: {}
js/sticky.js: {}
这很好用,就像我想要的那样。但是当我注销时,没有加载 core-jQuery 。所以我发现,我必须添加:
dependencies:
- core/jquery: {}
使 Drupal 为匿名用户集成 jQuery。但是每次我添加行依赖项:- core/jquery: {} 并清除缓存时,整个站点都会中断并且 returns 出现白屏:
"The website encountered an unexpected error. Please try again later."
- core/jquery: {}
应该只是 - core/jquery
这是一个例子:
my_awsome_module:
version: 1.x
js:
js/my_awesome_module.js: {}
dependencies:
- core/jquery
- core/jquery.once
我是 Drupal (8) 的新手,它是模板系统。我设置了一个 themename.libraries.yml 和一个 themename.info.yml 看起来像这样:
xxx.info.yml:
name: xxx
description: theme for xxx
type: theme
core: 8.x
package: Custom
basetheme: classy
libraries:
- xxx/stylesheets
- xxx/javascript
regions:
content: Content
pagetitle: Pagetitle
searchblock: Searchblock
xxx.libraries.yml
stylesheets:
css:
theme:
css/style.css: {}
https://fonts.googleapis.com/css?family=Open+Sans: {}
https://fonts.googleapis.com/css?family=Montserrat: {}
javascript:
js:
js/site.js: {}
js/sticky.js: {}
这很好用,就像我想要的那样。但是当我注销时,没有加载 core-jQuery 。所以我发现,我必须添加:
dependencies:
- core/jquery: {}
使 Drupal 为匿名用户集成 jQuery。但是每次我添加行依赖项:- core/jquery: {} 并清除缓存时,整个站点都会中断并且 returns 出现白屏:
"The website encountered an unexpected error. Please try again later."
- core/jquery: {}
应该只是 - core/jquery
这是一个例子:
my_awsome_module:
version: 1.x
js:
js/my_awesome_module.js: {}
dependencies:
- core/jquery
- core/jquery.once