innocode-digital/wp-cli-scaffold-theme-command

生成基于 Innocode 主题骨架的主题起始代码。

1.5.1 2019-10-25 11:23 UTC

This package is auto-updated.

Last update: 2024-09-25 22:23:03 UTC


README

快速链接: 使用 | 安装 | 贡献

使用

此包实现了以下命令

wp scaffold theme

生成基于 Innocode 主题骨架的主题起始代码。

wp scaffold theme <slug> [--activate] [--enable-network] [--name=<title>] [--author=<full-name>] [--author_uri=<uri>] [--force]

有关更多信息,请参阅 WP Theme Skeleton

选项

<slug>
    The slug for the new theme.

[--activate]
    Activate the newly downloaded theme.

[--enable-network]
    Enable the newly downloaded theme for the entire network.

[--name=<title>]
    What to put in the 'Theme Name:' header in 'style.css'. Default is <slug> with uppercase first letter.
	
[--version=<version>]
    What to put in the 'Version:' header in 'style.css' and in the 'version' property in 'composer.json' and 'package.json' files. Default is '1.0.0'.
    
[--description=<text>]
    What to put in the 'Description:' header in 'style.css' and in the 'description' property in 'composer.json' and 'package.json' files. Default is ''.

[--author=<full-name>]
    What to put in the 'Author:' header in 'style.css'. Default is 'Innocode'.

[--author_uri=<uri>]
    What to put in the 'Author URI:' header in 'style.css'. Default is 'https://innocode.com/'.

[--text_domain=<domain>]
    What to put in the 'Text Domain:' header in 'style.css'. Default is <slug>.
    
[--repo=<slug>]
    What is a repo on Github for this project. Default is 'innocode-digital/<slug>'.

[--force]
    Overwrite files that already exist.
    
[--skeleton_source=<source>]
	What is a source of skeleton theme. Possible values are 'github' and 'zip'. Default is 'github'.

[--source_username=<username>]
	What is a username on Github. Default is 'innocode-digital'.

[--source_repo=<repo>]
	What is a repository on Github. No need to use it when <skeleton_source> is 'zip'. Default is 'wp-theme-skeleton'.

[--source_url=<url>]
	What is an URL of source. Applicable only when <skeleton_source> is 'zip'.

[--skip-env]
	Don't generate .env file.

[--skip-install-notice]
	Don't show notice about need to run installation commands.

安装

安装此包需要 WP-CLI v2.0.0 或更高版本。使用 wp cli update 更新到最新稳定版本。

完成此操作后,您可以使用以下命令安装此包

wp package install innocode-digital/wp-cli-scaffold-theme-command

为了能够认证到 Github,以便能够检索您的用户数据并将其插入到 composer.json 中作为作者,以及插入到 package.json 中作为贡献者,在构建过程中以及在您想使用私有骨架仓库的情况下,您需要使用以下方法之一添加令牌

  • 从命令行将 OAuth 令牌添加到您的本地 auth.json
composer config -g github-oauth.github.com xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • $HOME/.composer/auth.json 中手动将 OAuth 令牌添加到您的本地 auth.json
{
    "github-oauth": {
        "github.com": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
}
  • wp-config.php 中定义 GITHUB_PAT 常量
define( 'GITHUB_PAT', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' );

要生成令牌,请转到 设置 / 开发者设置。令牌应至少具有以下作用域

  • repo - 对私有仓库的完全控制
  • user
    • read:user - 读取所有用户配置文件数据