Update README [ci skip]
This commit is contained in:
28
README.md
28
README.md
@@ -36,29 +36,33 @@ $ composer create-project roots/sage your-theme-name dev-master
|
|||||||
## Theme structure
|
## Theme structure
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
themes/theme-name/ # → Root of your Sage based theme
|
themes/your-theme-name/ # → Root of your Sage based theme
|
||||||
├── assets # → Front-end assets
|
├── assets # → Front-end assets
|
||||||
│ ├── config.json # → Settings for compiled assets
|
│ ├── config.json # → Settings for compiled assets
|
||||||
|
│ ├── build/ # → Webpack and ESLint config
|
||||||
│ ├── fonts/ # → Theme fonts
|
│ ├── fonts/ # → Theme fonts
|
||||||
│ ├── images/ # → Theme images
|
│ ├── images/ # → Theme images
|
||||||
│ ├── scripts/ # → Theme JS
|
│ ├── scripts/ # → Theme JS
|
||||||
│ └── styles/ # → Theme stylesheets
|
│ └── styles/ # → Theme stylesheets
|
||||||
├── composer.json # → Autoloading for `src/` files
|
├── composer.json # → Autoloading for `src/` files
|
||||||
├── composer.lock # → Composer lock file (never manually edit)
|
├── composer.lock # → Composer lock file (never edit)
|
||||||
├── dist/ # → Built theme assets (never manually edit)
|
├── dist/ # → Built theme assets (never edit)
|
||||||
├── functions.php # → Never manually edit
|
├── functions.php # → Composer autoloader, theme includes
|
||||||
├── index.php # → Never manually edit
|
├── index.php # → Never manually edit
|
||||||
├── node_modules/ # → Node.js packages (never manually edit)
|
├── node_modules/ # → Node.js packages (never edit)
|
||||||
├── package.json # → Node.js dependencies and scripts
|
├── package.json # → Node.js dependencies and scripts
|
||||||
├── screenshot.png # → Theme screenshot for WP admin
|
├── screenshot.png # → Theme screenshot for WP admin
|
||||||
├── src/ # → Theme PHP
|
├── src/ # → Theme PHP
|
||||||
|
│ ├── lib/Sage/ # → Theme wrapper, asset manifest
|
||||||
|
│ ├── admin.php # → Theme customizer setup
|
||||||
|
│ ├── filters.php # → Theme filters
|
||||||
|
│ ├── helpers.php # → Helper functions
|
||||||
|
│ └── setup.php # → Theme setup
|
||||||
├── style.css # → Theme meta information
|
├── style.css # → Theme meta information
|
||||||
├── templates/ # → Theme templates
|
├── templates/ # → Theme templates
|
||||||
│ ├── layouts/ # → Base templates
|
│ ├── layouts/ # → Base templates
|
||||||
│ └── partials/ # → Partial templates
|
│ └── partials/ # → Partial templates
|
||||||
├── vendor/ # → Composer packages (never manually edit)
|
└── vendor/ # → Composer packages (never edit)
|
||||||
├── watch.js # → Webpack/BrowserSync watch config
|
|
||||||
└── webpack.config.js # → Webpack config
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Theme setup
|
## Theme setup
|
||||||
@@ -80,7 +84,7 @@ $ npm install
|
|||||||
|
|
||||||
You now have all the necessary dependencies to run the build process.
|
You now have all the necessary dependencies to run the build process.
|
||||||
|
|
||||||
### Available build commands
|
### Build commands
|
||||||
|
|
||||||
* `npm run build` — Compile and optimize the files in your assets directory
|
* `npm run build` — Compile and optimize the files in your assets directory
|
||||||
* `npm run start` — Compile assets when file changes are made, start BrowserSync session
|
* `npm run start` — Compile assets when file changes are made, start BrowserSync session
|
||||||
@@ -88,16 +92,16 @@ You now have all the necessary dependencies to run the build process.
|
|||||||
|
|
||||||
### Using BrowserSync
|
### Using BrowserSync
|
||||||
|
|
||||||
To use BrowserSync during `npm watch` you need to update `devUrl` at the bottom of `assets/config.json` to reflect your local development hostname.
|
To use BrowserSync during `npm run start` you need to update `devUrl` at the bottom of `assets/config.json` to reflect your local development hostname.
|
||||||
|
|
||||||
For example, if your local development URL is `https://project-name.dev` you would update the file to read:
|
If your local development URL is `https://project-name.dev`, update the file to read:
|
||||||
```json
|
```json
|
||||||
...
|
...
|
||||||
"devUrl": "https://project-name.dev",
|
"devUrl": "https://project-name.dev",
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are not using [Bedrock](https://roots.io/bedrock/), you should also update `publicPath` to reflect your folder structure:
|
If you are not using [Bedrock](https://roots.io/bedrock/), update `publicPath` to reflect your folder structure:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
...
|
...
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ add_action('customize_render_section', function ($section) {
|
|||||||
* Please note that missing files will produce a fatal error.
|
* Please note that missing files will produce a fatal error.
|
||||||
*/
|
*/
|
||||||
$sage_includes = [
|
$sage_includes = [
|
||||||
'src/helpers.php', // Helper functions
|
'src/helpers.php',
|
||||||
'src/setup.php', // Theme setup
|
'src/setup.php',
|
||||||
'src/filters.php', // Filters
|
'src/filters.php',
|
||||||
'src/admin.php' // Admin
|
'src/admin.php'
|
||||||
];
|
];
|
||||||
array_walk($sage_includes, function ($file) {
|
array_walk($sage_includes, function ($file) {
|
||||||
if (!locate_template($file, true, true)) {
|
if (!locate_template($file, true, true)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user