无法在 gitbook 主题中添加自定义模板文件 [英] not able to add custom template files in gitbook themes

查看:50
本文介绍了无法在 gitbook 主题中添加自定义模板文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个自定义 gitbook 主题,并且我还想更改布局,以便我使用该主题创建的书具有我想要的布局.我复制了自定义主题的assests 目录中的默认模板目录,然后根据需要修改了layout.html 和header.html 文件.然后为了包含修改后的模板文件,我在 index.js 文件中添加了以下属性

I am trying to create a custom gitbook theme and in that I also want to change the layout so that the book I create using the theme have the layout that I want. I copied the default templates dir in my assests dir of the custom theme and then modified the layout.html and header.html files as I wanted. Then to include the modified template files, I added the following attribute to the index.js file

module.exports = {
    book: {
        assets: "./assests",
        templates: {
            "layout":"templates/layout.html",
            "header":"templates/includes/book/header.html",
        },
......
......

但是,使用此配置,生成的书籍不会选择模板文件更改.但是我确实看到了我所做的 css/js 更改.

However with this configuration, the generated book is not picking the template file changes. However I do see the css/js changes that I had done.

推荐答案

模板布局"和标题"不存在.您只能更改:

Templates "layout" and "header" don't exist. You can only change:

  • 网站:网站模板
  • 词汇表:词汇表模板
  • langs:用于选择语言的模板
  • 页面:电子书模板
  • site: template for the website
  • glossary: template for the glossary
  • langs: template for the choice of languages
  • page: template for the ebook

确实不建议更改模板,您应该使用插件来仅扩展 html,css,js 使用:https://github.com/GitbookIO/plugin/blob/master/index.js#L2

Changing templates is really not advised, you should use plugins to only extend html,css,js using: https://github.com/GitbookIO/plugin/blob/master/index.js#L2

这篇关于无法在 gitbook 主题中添加自定义模板文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆