You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A command-line interface (CLI) that generates a WordPress theme structure from a single HTML file. This tool creates `header.php` and `footer.php` files by extracting content from the provided HTML file, using `<!-- wp:file ... -->` and `<!-- /wp:file -->` comment tags to identify the relevant sections.
5
+
A command-line interface (CLI) that streamlines WordPress theme development. It generates a complete WordPress theme structure (including `header.php`, `footer.php`, `index.php`, `style.css`, and `functions.php`) from a single HTML file, using `<!-- wp:file ... -->` comment tags for content separation. It also provides a command to quickly scaffold new HTML templates.
6
6
7
7
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
8
8
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [A Focus on Quality and Productivity](#a-focus-on-quality-and-productivity)
25
+
- [The Cost of Stale Documentation](#the-cost-of-stale-documentation)
26
+
- [The Power of Workflow Scripts](#the-power-of-workflow-scripts)
27
+
- [📦 Release & Versioning](#-release--versioning)
28
+
- [How it Works](#how-it-works)
29
+
- [Creating a New Release](#creating-a-new-release)
30
+
- [Your First Release](#your-first-release)
31
+
- [📁 Project Structure](#-project-structure)
32
+
- [✍️ Linting for Documentation](#-linting-for-documentation)
33
+
- [How to Check for Missing Documentation](#how-to-check-for-missing-documentation)
34
+
- [Example](#example)
35
+
- [🤝 Contributing](#-contributing)
36
+
- [🗺️ Roadmap](#-roadmap)
37
+
- [⚖️ Code of Conduct](#-code-of-conduct)
38
+
- [🙏 Acknowledgements](#-acknowledgements)
39
+
- [👨💻 About the Author](#-about-the-author)
40
+
- [📄 License](#-license)
42
41
43
42
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
44
43
45
44
## ✨ Key Features
46
45
46
+
- **WordPress Theme Generation**: Quickly generate a full WordPress theme (including `header.php`, `footer.php`, `index.php`, `style.css`, and `functions.php`) from a single HTML file.
47
+
- **HTML-to-PHP Conversion**: Intelligently extracts content based on `<!-- wp:file ... -->` and `<!-- /wp:file -->` HTML comment tags to create corresponding PHP template files.
48
+
- **Customizable Theme Metadata**: Easily define theme name, author, description, and other details via CLI options, which are automatically included in `style.css` and PHP file headers.
49
+
- **HTML Template Scaffolding**: Generate new HTML template files pre-configured with `wp:file` tags, accelerating new page development.
47
50
- **Comprehensive Testing Suite**: Pre-configured with Jest for unit and integration testing. Includes coverage reporting out-of-the-box to ensure code quality.
48
51
- **Automated Code Quality**: A strict, pre-configured setup using ESLint and Prettier to catch errors, enforce best practices, and maintain a consistent code style across all files (`.js`, `.md`, `.json`).
49
52
- **Enforced Documentation Standards**: Integrated `eslint-plugin-jsdoc` to require JSDoc comments for all functions, improving code clarity and long-term maintainability.
@@ -59,42 +62,96 @@ A command-line interface (CLI) that generates a WordPress theme structure from a
59
62
60
63
- Node.js version 18.0.0 or higher
61
64
62
-
### Using this Template
65
+
## Installation
63
66
64
-
There are two recommended ways to use this template to start your project.
67
+
1. Install the package globally (recommended):
65
68
66
-
#### Method 1: GitHub Template (Recommended)
69
+
```bash
70
+
npm install -g php-theme-gen
71
+
```
67
72
68
-
This is the best approach for creating a new repository on GitHub that is linked to this template.
73
+
The `phpgen` app is available globally. In any folder on your computer, check it runs:
69
74
70
-
1. Click the green **"Use this template"** button on the [main repository page](https://github.com/ioncakephper/php-theme-gen).
71
-
2. Select **"Create a new repository"**.
72
-
3. Give your new repository a name and description, then create it.
73
-
4. Clone your newly created repository to your local machine, replacing `YOUR_USERNAME` and `YOUR_REPOSITORY_NAME`:
The `php-theme-gen` CLI tool allows you to quickly generate a WordPress theme structure from a single HTML file.
94
+
95
+
### `build` Command
96
+
97
+
The `build` command is used to process your HTML file and generate the theme files.
98
+
99
+
```bash
100
+
node src/index.js build <sourceFile> [options]
101
+
```
102
+
103
+
**Arguments:**
104
+
105
+
- `<sourceFile>`: The path to your source HTML file. This file should contain `<!-- wp:file name="header" -->` and `<!-- wp:file name="footer" -->` HTML comments to delineate the header and footer sections.
106
+
107
+
**Options:**
108
+
109
+
- `-o, --output <dir>`: The output directory for the generated theme files. Defaults to `dist`.
110
+
- `--themeName <name>`: The name of your WordPress theme. This will be used in the theme's `style.css` and PHP file headers. Defaults to `MyTheme`.
111
+
- `--themeURI <uri>`: The URI of your theme.
112
+
- `--author <name>`: The author of the theme.
113
+
- `--authorURI <uri>`: The author's URI.
114
+
- `--description <text>`: A brief description of your theme.
115
+
- `--tags <tags>`: Comma-separated tags for your theme (e.g., `blog, responsive`).
116
+
117
+
**Example:**
118
+
119
+
To generate a theme from `demo/index.html` into the `demo/mytheme` directory with a custom theme name:
0 commit comments