具有现代开发工作流程的WordPress起始主题

安装: 17

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 3,056

类型:wordpress-theme

9.0.1 2018-04-30 18:52 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 21stdigital/sage your-theme-name

要安装Sage的最新开发版本,请将dev-master添加到命令末尾

$ composer create-project 21stdigital/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

社区

跟踪开发和社区新闻。