AT 子主题开发

安装并启用

composer require drupal/adaptivetheme drupal/at_tools -vvv
drupal moi adaptivetheme at_tools at_theme_generator 

然后访问【外观】中的【AT子主题生成器】选项卡,生成子主题。假设子主题为 at_jungle

定制

由于墙的原因,at_core.libraries.ymlat_jungle.libraries.yml 中定义的库使用了 cloudfire 提供的 CDN,它在国内很慢,或者不能访问。所以要替换掉它们。

替换时,我们不去直接修改 at_core.libraries.yml 文件。而是在子主题中 override 它们。

语法参考此处的文档: Libraries can now be overridden and extended by themes 1

首先在子主题的at_jungle.libraries.yml文件中添加不使用 cloudfire CDN 后的库的定义。

然后,在at_jungle.info.yml,替换掉 at_core.libraries.yml中定义的相对于的库。

或者直接修改(如 at_jungle/base 中的 fontawesome)

但是好像不能直接用子主题中定义的一个库替换另外一个库,如:at_jungle/animate: at_jungle/at_jungle.animate

以下是at_jungle.info.yml文件的部分内容:

libraries-override:
  at_core/at.enquire: at_jungle/at_jungle.enquire
  at_core/at.fontfaceobserver: at_jungle/at_jungle.fontfaceobserver
  at_core/at.slideshow: at_jungle/at_jungle.slideshow
  at_core/at.waypoints: at_jungle/at_jungle.waypoints
  at_core/at.waypoints_sticky: at_jungle/at_jungle.waypoints_sticky
  at_core/at.waypoints_inview: at_jungle/at_jungle.waypoints_inview
  at_core/at.waypoints_infinite: at_jungle/at_jungle.waypoints_infinite
  at_core/at.matchheight: at_jungle/at_jungle.matchheight
  at_core/at.enquire: at_jungle/at_jungle.enquire
  at_core/at.fontfaceobserver: at_jungle/at_jungle.fontfaceobserver
  at_core/at.headroom: at_jungle/at_jungle.headroom
  at_core/at.masonry: at_jungle/at_jungle.masonry
  at_core/at.html5shiv: at_jungle/at_jungle.html5shiv
  at_core/at.respond: at_jungle/at_jungle.respond
  at_core/at.selectivizr: at_jungle/at_jungle.selectivizr
  at_core/at.yui3: at_jungle/at_jungle.yui3
  at_jungle/base:
    css:
      base:
        styles/css/components/font-awesome.css: libraries/fontawesome/css/font-awesome.css

标签