首页 > 技术文章 > GHOST CMS - Package.json

QDuck 2019-12-21 17:03 原文

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 

推荐阅读