WordPress启动主题,拥有现代化的开发工作流程

安装: 28

依赖项: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

Forks: 3,056

类型:wordpress-theme

9.0.30 2018-05-20 10:17 UTC

README

Packagist devDependency Status Build Status

Sage是一个具有现代化开发工作流程的WordPress启动主题。

功能

roots-example-project.com查看工作示例。

要求

在继续之前,请确保已安装所有依赖项

主题安装

使用Composer从WordPress主题目录安装Sage(以下将 your-theme-name 替换为您主题的名称)

# @ app/themes/ or wp-content/themes/
$ composer create-project roots/sage 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
├── 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
│   ├── 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/sage

构建命令

  • yarn start — 当文件更改时编译资源,启动Browsersync会话
  • yarn build — 编译并优化您的资源目录中的文件
  • yarn build:production — 编译生产资源

文档

贡献

欢迎所有人贡献。我们有一些贡献指南 帮助您开始。

金牌赞助商

通过在OpenCollective上对Sage进行贡献 支持我们的开源开发工作。

Kinsta KM Digital

社区

跟踪开发和社区新闻。