nicbeltramelli / zen
基于 Genesis 框架的子主题,具有现代的开发工作流程
4.3.1
2021-07-05 17:01 UTC
Requires
- php: >=7.1
- composer/installers: ~1.0
- wpackio/enqueue: ^3.2.1
Requires (Dev)
- dev-master
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1
- 4.0
- 3.6.0
- 3.5.1
- 3.5.0
- 3.4.0
- 3.3.0
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.0
- 2.6.0
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/socket.io-parser-3.3.3
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/minimist-1.2.6
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/node-sass-7.0.0
- dev-dependabot/npm_and_yarn/nanoid-3.2.0
- dev-dependabot/npm_and_yarn/nth-check-2.0.1
- dev-dependabot/npm_and_yarn/tar-6.1.11
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
This package is auto-updated.
Last update: 2024-09-05 20:20:47 UTC
README
Zen 是一个基于 Genesis 框架的子主题,拥有现代的开发工作流程。 在线演示
已测试至 WordPress 5.7.2 和 Genesis 3.3.3。
功能
- 从 npm 注册表消费包
- 现代 JavaScript
- 使用 SASS/SCSS 为样式表
- 使用 Autoprefixer 以使 CSS 能够与所需的供应商前缀一起工作
- 使用 Webpack 压缩和捆绑代码
- 拆分大文件并将生成的部分入队
- 使用 Browsersync](http://www.browsersync.io/) 同步浏览器测试
要求
在继续之前,请确保已安装所有要求
主题安装
使用 Composer 从您的 WordPress 主题目录安装 Zen(将下面的 your-theme-name
替换为您主题的名称)
# initialize the theme $ composer create-project nicbeltramelli/zen your-theme-name # move inside your theme folder $ cd your-theme-name # install front-end dependencies $ yarn # bootstrap project $ yarn bootstrap
主题设置
- 编辑
style.css
以定义您的主题元信息(名称、URI、描述、版本、作者) - 编辑处理开发服务器的
wpackio.server.js
proxy
应反映您的本地开发 URL,例如'http://your-address.local'
distPublicPath
应反映您 dist 文件夹的绝对 URL 路径,例如'/wp-content/themes/your-theme-name/dist/'
您必须添加一个反斜杠在末尾,否则它将无法正常工作。
主题开发
# start development server $ yarn start # create production build $ yarn build # create distribution package $ yarn archive
WordPress 编码标准
composer phpcs
— 运行 WordPress 编码标准检查composer phpcbf
— 自动修复 php 报警违规
主题结构
themes/your-theme-name/ # → Root of your child theme ├── src/ # → Front-end assets │ ├── scripts/ # → Theme JS │ └── styles/ # → Theme stylesheets ├── config/ # → Theme configuration data ├── dist/ # → Built theme assets (never edit) ├── lib/ # → Theme PHP library │ ├── blocks/ # → Add support for Gutenberg blocks │ ├── structure/ # → Theme structure │ ├── woocommerce/ # → WooCommerce PHP library │ ├── admin.php # → Adds the admin dashboard setting │ ├── assets.php # → Enqueue assets │ ├── body-classes.php # → Adds consistent classes to the body tag │ ├── customize.php # → Adds the Customizer addition │ ├── defaults.php # → Configures the default theme settings │ ├── errors.php # → Displays error messages │ ├── extras.php # → Custom functions │ ├── helpers.php # → Adds the required helper functions │ ├── output.php # → Adds the required CSS to the front-end │ └── setup.php # → Defines theme constants and features ├── node_modules/ # → Node.js packages (never edit) ├── page-templates/ # → Custom page templates ├── vendor/ # → Composer packages (never edit) ├── composer.json # → Composer dependencies and scripts ├── composer.lock # → Composer lock file (never edit) ├── front-page.php # → Front page template ├── function.php # → Includes the theme PHP library ├── package.json # → Node.js dependencies and scripts ├── search.php # → Search template ├── style.css # → Theme meta informations ├── wpackio.project.js # → Project configuration ├── wpackio.server.js # → Dev server configuration └── yarn.lock # → Yarn lock file (never edit)