GHOST CMS - Ghost Handlebars主题 Ghost Handlebars Themes

Ghost Handlebars主题

Ghost Handlebars Themes 

Ghost主题层被设计为让开发人员和设计人员能够灵活地构建由Ghost平台支持的自定义发布

The Ghost theme layer has been engineered to give developers and designers the flexibility to build custom publications that are powered by the Ghost platform.

主题开发

Theme development

Ghost主题使用了Handlebars模板语言,它使用helper类在模板(HTML)和任何JavaScript逻辑之间创建了一个强隔离。这使得主题可以非常快,有动态的客户端应用程序和服务器端发布内容,这些内容以静态HTML的形式发送到浏览器。

Ghost themes use the Handlebars templating language which creates a strong separation between templates (the HTML) and any JavaScript logic with the use of helpers. This allows themes to be super fast, with a dynamic client side app, and server side publication content that is sent to the browser as static HTML.

Ghost还利用了一个名为express-hbs的附加库,它为把手增加了一些额外的功能,比如布局和局部。

Ghost also makes use of an additional library called express-hbs which adds some additional features to Handlebars, such as layouts and partials.

本文档为您提供了为主题创建静态HTML和CSS所需的工具,在需要呈现动态数据时使用把手表达式。

This documentation gives you the tools required to create static HTML and CSS for a theme, using Handlebars expressions when you need to render dynamic data.

Handlebars

Handlebars模板语言提供了有效构建语义模板的能力。该文档为您提供了开始为您的出版物开发主题所需的所有知识。另外,如果你想熟悉官方的把手文档并学习更多的基本表达,使用这些有用的资源:

The Handlebars templating language provides the power to build semantic templates effectively. This documentation gives you all the knowledge you need to start developing a theme for your publication. In addition, if you would like to make yourself familiar with the official Handlebars docs and learn more about basic expressions, use these helpful resources:

在Ghost中已经为您完成了Handlebars的安装

Installation of Handlebars is already done for you in Ghost ✨

GScan

验证你的Ghost主题是有效地处理,使用GScan工具。GScan会检查你的主题是否有错误、不支持和兼容性问题。GScan有几种用途:

Validating your Ghost theme is handled efficiently with the GScan tool. GScan will check your theme for errors, deprecations and compatibility issues. GScan is used in several ways:

  • GScan站点是测试您正在构建的任何主题以获得完整验证报告的第一个调用端口 The GScan site is your first port of call to test any themes that you're building to get a full validation report

  • 当一个主题是上传 Ghost 管理,它将自动检查与gscan和任何致命的错误将阻止使用的主题 When a theme is uploaded in Ghost admin, it will automatically be checked with gscan and any fatal errors will prevent the theme from being used

  • gscan is also used as a command line tool

Command line

To use GScan as a command line tool, globally install the gscan npm package:

Terminal
# Install the npm package
npm install -g gscan

# Use gscan <file path> anywhere to run gscan against a folder
gscan /path/to/ghost/content/themes/casper

# Run gscan on a zip file gscan -z /path/to/download/theme.zip

What's next?

That's all of the background context required to get started. From here you'll take a look at the structure of Ghost themes and templates, and learn everything you need to know about the package.json file.

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

猜你喜欢

转载自www.cnblogs.com/QDuck/p/12077136.html
今日推荐