innocode-digital / wp-cli-scaffold-theme-command
生成基于 Innocode 主题骨架的主题起始代码。
1.5.1
2019-10-25 11:23 UTC
Requires
- ext-json: *
- gettext/gettext: ^4.6
- knplabs/github-api: ^2.10
- localheinz/json-printer: ^2.0
- php-http/guzzle6-adapter: ^1.1
- wp-cli/scaffold-command: *
- wp-cli/wp-cli: ^2
Requires (Dev)
- behat/behat: ~2.5
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
- 读取所有用户配置文件数据