GHOST CMS - Package.json

Package.json

The package.json file is a set of meta data about a theme.

package.json 文件是一组关于主题的元数据。

Overview概述

The package.json file is a required file and sets some information about your theme. Edit this file and keep it up to date with the relevant information about your publication's theme.

To reference a working example of a package.json file, review the Casper file, and for further information about specific details of package.json handling, read the npm docs.

package.json文件是一个必需的文件,它设置了一些关于主题的信息。编辑此文件并使其与您的出版物的主题相关信息保持最新。

以引用包package.json文件的工作示例,查看Casper文件,了解包的详细信息。json处理,阅读npm docs

Example

package.json
{
    "name": "your-theme-name",
    "description": "A brief explanation of your theme",
    "version": "0.5.0",
    "engines": {
        "ghost-api": "v3"
    },
    "license": "MIT",
    "author": {
        "email": "your@email.here"
    },
    "config": {
        "posts_per_page": 10,
        "image_sizes": {}
    }
}

The data in the file must be valid JSON, including double quotes around all property names. Every property except the last one should be separated by a comma.

文件中的数据必须是有效的JSON,包括所有属性名周围的双引号。除了最后一个属性外,所有属性之间都应该用逗号分隔

Additional properties额外的属性

Here are some of the most common optional properties that can be used in the package.json file:

下面是可以在包中使用的一些最常见的可选属性package.json 文件:

  • config.posts_per_page -每页的缺省文章数为5,或者您可以使用此属性设置自定义数量   the default number of posts per page is 5, or you can set a custom amount with this property 
  • config.image_sizes -详情请参阅响应图像指南 read the responsive images guide for more details
  • engines.ghost-api - 说明您的主题与Ghost内容API的哪个版本兼容,默认为v0.1  indicate what version of the Ghost Content API your theme is compatible with, defaults to v0.1
  • description - 提供一个关于你的主题的简短描述,以及它的独特之处 provide a short description about your theme and what makes it unique
  • license - 一个有效的许可证字符串,我们推荐MIT a valid licence string, we recommend MIT 😉

Changes to the package.json require a restart, use the command ghost restart to do so.

对包的更改。json需要重新启动,使用命令ghost restart来做到这一点。

Next steps下一步

This concludes the introduction to and overview of Ghost themes. The rest of this documentation explores how contexts and helpers work, and provides a full reference list of available helpers to guide your theme development.

For community led support about theme development, visit the forum.

这就结束了 Ghost主题的介绍和概述。本文档的其余部分将探索上下文和帮助程序如何工作,并提供可用帮助程序的完整参考列表,以指导主题开发。

对于社区主导的主题开发支持,请访问论坛。

posted @ 2019-12-21 17:03  QDuck  阅读(141)  评论(0编辑  收藏  举报