cdk-comp / cdkage
具有现代开发工作流程的WordPress起始主题
1.0.5
2018-10-02 19:55 UTC
Requires
- php: >=7.1
- composer/installers: ~1.0
- illuminate/support: 5.6.*
- roots/sage-lib: ~9.0.5
- soberwp/controller: ~2.1.0
- stoutlogic/acf-builder: ^1.8
Requires (Dev)
- jakub-onderka/php-parallel-lint: ^1.0
- jakub-onderka/php-var-dump-check: ^0.2.0
- squizlabs/php_codesniffer: ^2.8.0
This package is not auto-updated.
Last update: 2024-09-29 23:50:59 UTC
README
CDKAGE是一个基于Sage的WordPress起始主题,具有现代开发工作流程。
特性
- Sass样式表
- 现代JavaScript
- 使用Webpack编译资源、优化图片、合并和压缩文件
- 使用Browsersync进行同步浏览器测试
- 使用Blade作为模板引擎
- 使用Controller将数据传递给Blade模板
- 支持自定义模块开发,使用ACF
- 使用构建模式和流畅API配置ACF Builder的配置数组以使用Advanced Custom Fields Pro
- 支持自定义模块开发,使用Ultimate Fields
在roots-example-project.com上查看一个工作示例。
要求
在继续之前,请确保已安装所有依赖项
- WordPress >= 4.9.8
- Advanced Custom Fields >= 5.7.6或
- Ultimate Fields >= 3.0.2
- PHP >= 7.1.3(启用
php-mbstring
) - Composer
- Node.js >= 6.9.x
- Yarn
主题安装
使用Composer从WordPress主题目录安装CDKage(将下面的your-theme-name
替换为您的主题名称)
# @ app/themes/ or wp-content/themes/
$ composer create-project cdk-comp/cdkage your-theme-name
要安装Sage的最新开发版本,请将dev-master
添加到命令末尾
$ composer create-project roots/sage your-theme-name dev-master
在主题安装过程中,您将有权更新style.css
主题头部、选择CSS框架和配置Browsersync。
主题结构
themes/your-theme-name/ # → Root of your Sage based theme ├── app/ # → Theme PHP │ ├── Controllers/ # → Controller files │ ├── admin.php # → Theme customizer setup │ ├── filters.php # → Theme filters │ ├── helpers.php # → Helper functions │ ├── setup.php # → Theme setup │ ├── wcf-check.php # → Check if required plugin's exist │ ├── wcf-init.php # → Init option page for module management │ ├── wcf-modules.php # → Module management for ACF/Ultimate fields │ └── setup.php # → Theme setup ├── composer.json # → Autoloading for `app/` files ├── composer.lock # → Composer lock file (never edit) ├── dist/ # → Built theme assets (never edit) ├── node_modules/ # → Node.js packages (never edit) ├── package.json # → Node.js dependencies and scripts ├── resources/ # → Theme assets and templates │ ├── assets/ # → Front-end assets │ │ ├── config.json # → Settings for compiled assets │ │ ├── build/ # → Webpack and ESLint config │ │ ├── fonts/ # → Theme fonts │ │ ├── images/ # → Theme images │ │ ├── scripts/ # → Theme JS │ │ └── styles/ # → Theme stylesheets │ ├── functions.php # → Composer autoloader, theme includes │ ├── index.php # → Never manually edit │ ├── modules/ # → Module loads and config │ │ ├── **/fields.php # → Fields management │ │ ├── **/partial.blade.php # → Module template │ │ ├── **/script.js # → Module JS │ │ ├── **/style.scss # → Module stylesheets │ │ └── class-module-loader.php # → Settings for compiled assets │ ├── screenshot.png # → Theme screenshot for WP admin │ ├── style.css # → Theme meta information │ └── views/ # → Theme templates │ ├── layouts/ # → Base templates │ └── partials/ # → Partial templates └── vendor/ # → Composer packages (never edit)
主题设置
编辑app/setup.php
以启用或禁用主题功能、设置导航菜单、文章缩略图大小和侧边栏。
主题开发
- 从主题目录运行
yarn
以安装依赖项 - 更新
resources/assets/config.json
设置devUrl
应反映您的本地开发主机名publicPath
应反映您的WordPress文件夹结构(对于非Bedrock安装,为/wp-content/themes/cdkage
)
构建命令
yarn start
— 当文件更改时编译资源,启动Browsersync会话yarn build
— 编译并优化您的资产目录中的文件yarn build:production
— 为生产编译资源
文档
贡献
欢迎所有人贡献。
CDKage赞助商
通过以下方式支持我们的开源开发工作
社区
- 在Telegram上参与
待办事项
- 使用 cdk-comp/bedrock 和 vagrant-easyengine 创建示例项目
- 更新 Node.js 的依赖项
- 制作 ACF 建造模块
- 包含关于 CDKage 的展示屏幕录制