@phcdevworks/spectre-shell-wordpress 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @phcdevworks/spectre-shell-wordpress might be problematic. Click here for more details.
- package/.devcontainer/devcontainer.json +40 -0
- package/.gitattributes +203 -0
- package/.github/FUNDING.yml +6 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- package/.github/ISSUE_TEMPLATE/docs_request.md +11 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +13 -0
- package/.github/dependabot.yml +12 -0
- package/.github/pull_request_template.md +15 -0
- package/.vscode/extensions.json +31 -0
- package/CHANGELOG.md +80 -0
- package/CODE_OF_CONDUCT.md +80 -0
- package/CONTRIBUTING.md +194 -0
- package/LICENSE +21 -0
- package/README.md +338 -0
- package/SECURITY.md +94 -0
- package/index.html +13 -0
- package/package.json +52 -0
- package/public/vite.svg +1 -0
- package/spectre-shell-wordpress.code-workspace +8 -0
- package/spectre-theme/README.md +33 -0
- package/spectre-theme/footer.php +9 -0
- package/spectre-theme/functions.php +89 -0
- package/spectre-theme/header.php +35 -0
- package/spectre-theme/index.php +60 -0
- package/spectre-theme/style.css +20 -0
- package/src/README.md +56 -0
- package/src/js/main.ts +11 -0
- package/src/styles/main.css +12 -0
- package/tailwind.config.ts +12 -0
- package/tsconfig.json +33 -0
- package/vite.config.ts +38 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# Contributing to Spectre Shell WordPress
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve Spectre Shell! This package is a reusable template for building modern WordPress themes with Vite, TypeScript, and Tailwind CSS 4.
|
|
4
|
+
|
|
5
|
+
## Development Philosophy
|
|
6
|
+
|
|
7
|
+
This template follows a **build tool first** approach:
|
|
8
|
+
|
|
9
|
+
### 1. Build Configuration (Vite + Tailwind)
|
|
10
|
+
|
|
11
|
+
**Purpose**: Single source of truth for asset compilation and optimization
|
|
12
|
+
|
|
13
|
+
**Exports**: Compiled CSS and JavaScript to `spectre-theme/dist/` with manifest
|
|
14
|
+
|
|
15
|
+
**Rules**:
|
|
16
|
+
|
|
17
|
+
- Vite config defines asset pipeline and WordPress integration
|
|
18
|
+
- Tailwind config defines design utilities and theme
|
|
19
|
+
- All source files compile through Vite
|
|
20
|
+
|
|
21
|
+
**Status**: v1.0.0 with stable dev/prod mode detection and HMR support
|
|
22
|
+
|
|
23
|
+
### 2. Source Assets (src/)
|
|
24
|
+
|
|
25
|
+
**Purpose**: Development files for TypeScript and CSS
|
|
26
|
+
|
|
27
|
+
**Ships**:
|
|
28
|
+
|
|
29
|
+
- `main.ts` (JavaScript entry point)
|
|
30
|
+
- `main.css` (CSS entry with Tailwind)
|
|
31
|
+
- Optional token/component organization
|
|
32
|
+
|
|
33
|
+
**Rules**:
|
|
34
|
+
|
|
35
|
+
- Keep source minimal and well-documented
|
|
36
|
+
- Import Tailwind via `@import` syntax
|
|
37
|
+
- Use TypeScript for type safety
|
|
38
|
+
|
|
39
|
+
**Status**: Basic structure ready for customization
|
|
40
|
+
|
|
41
|
+
### 3. WordPress Theme (spectre-theme/)
|
|
42
|
+
|
|
43
|
+
**Purpose**: WordPress templates and PHP functions that load Vite assets
|
|
44
|
+
|
|
45
|
+
**Key mechanism**:
|
|
46
|
+
|
|
47
|
+
- `functions.php` detects `WP_ENV` to switch dev/prod modes
|
|
48
|
+
- Dev mode loads from Vite server with HMR
|
|
49
|
+
- Prod mode loads manifest-based compiled assets
|
|
50
|
+
|
|
51
|
+
**Rules**:
|
|
52
|
+
|
|
53
|
+
- PHP never defines styles or scripts inline
|
|
54
|
+
- All assets load through Vite's manifest or dev server
|
|
55
|
+
- Follow WordPress coding standards
|
|
56
|
+
|
|
57
|
+
**Status**: Basic templates with asset loading ready
|
|
58
|
+
|
|
59
|
+
### Golden Rule (Non-Negotiable)
|
|
60
|
+
|
|
61
|
+
**Vite builds. WordPress loads. Source never ships.**
|
|
62
|
+
|
|
63
|
+
WordPress themes never ship raw source files—only compiled assets from `dist/`.
|
|
64
|
+
|
|
65
|
+
- If it's a build config → belongs in `vite.config.ts` or `tailwind.config.ts`
|
|
66
|
+
- If it's source code → belongs in `src/`
|
|
67
|
+
- If it's WordPress PHP → belongs in `spectre-theme/`
|
|
68
|
+
|
|
69
|
+
## Development Setup
|
|
70
|
+
|
|
71
|
+
1. Clone the repository:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/phcdevworks/spectre-shell-wordpress.git
|
|
75
|
+
cd spectre-shell-wordpress
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
2. Install dependencies:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npm install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
3. Build the package (compiles TypeScript and generates CSS):
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm run build
|
|
88
|
+
# or for development with watch mode:
|
|
89
|
+
npm run dev
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Project Structure
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
spectre-shell-wordpress/
|
|
96
|
+
├── src/
|
|
97
|
+
│ ├── js/
|
|
98
|
+
│ │ └── main.ts # JavaScript entry point
|
|
99
|
+
│ └── styles/
|
|
100
|
+
│ └── main.css # CSS entry with Tailwind
|
|
101
|
+
├── spectre-theme/
|
|
102
|
+
│ ├── dist/ # Built assets (generated)
|
|
103
|
+
│ ├── functions.php # Theme functions & asset loading
|
|
104
|
+
│ ├── header.php # Header template
|
|
105
|
+
│ ├── footer.php # Footer template
|
|
106
|
+
│ ├── index.php # Main template
|
|
107
|
+
│ └── style.css # WordPress theme metadata
|
|
108
|
+
├── vite.config.ts # Vite configuration
|
|
109
|
+
├── tailwind.config.ts # Tailwind configuration
|
|
110
|
+
└── package.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Responsibilities**:
|
|
114
|
+
|
|
115
|
+
- **Theme developers**: Edit `spectre-theme/` templates and `src/` assets
|
|
116
|
+
- **Config maintainers**: Update Vite and Tailwind configs
|
|
117
|
+
- **Build engineers**: Update build pipeline when structure changes
|
|
118
|
+
|
|
119
|
+
## Contribution Guidelines
|
|
120
|
+
|
|
121
|
+
### Configuration Development
|
|
122
|
+
|
|
123
|
+
1. **Never hardcode paths** – Use Node.js path resolution
|
|
124
|
+
2. **Test both modes** – Verify dev server and production builds
|
|
125
|
+
3. **Document changes** – Update README when config changes
|
|
126
|
+
4. **Keep it minimal** – Only include necessary options
|
|
127
|
+
|
|
128
|
+
### Source File Development
|
|
129
|
+
|
|
130
|
+
- Use TypeScript for type safety
|
|
131
|
+
- Follow modern ES module patterns
|
|
132
|
+
- Add comments for complex logic
|
|
133
|
+
- Import Tailwind properly with `@import 'tailwindcss'`
|
|
134
|
+
- Test in dev mode with HMR
|
|
135
|
+
|
|
136
|
+
### WordPress Theme Development
|
|
137
|
+
|
|
138
|
+
- Follow WordPress coding standards for PHP
|
|
139
|
+
- Never inline styles or scripts
|
|
140
|
+
- Use proper escaping and sanitization
|
|
141
|
+
- Test theme activation and asset loading
|
|
142
|
+
- Ensure compatibility with latest WordPress version
|
|
143
|
+
|
|
144
|
+
### Code Quality
|
|
145
|
+
|
|
146
|
+
- Use modern TypeScript + ES modules
|
|
147
|
+
- Follow WordPress PHP standards
|
|
148
|
+
- Add comments for complex logic
|
|
149
|
+
- Run `npm run build` before committing
|
|
150
|
+
- Test changes in both dev and prod modes
|
|
151
|
+
|
|
152
|
+
### Documentation
|
|
153
|
+
|
|
154
|
+
- Update README.md when adding features
|
|
155
|
+
- Include code examples for new features
|
|
156
|
+
- Document breaking changes in commit messages
|
|
157
|
+
- Keep inline comments clear and concise
|
|
158
|
+
|
|
159
|
+
## Pull Request Process
|
|
160
|
+
|
|
161
|
+
1. **Branch from `main`**
|
|
162
|
+
2. **Make your changes** and test locally (`npm run build` and verify in WordPress)
|
|
163
|
+
3. **Run build** to ensure compilation works (`npm run build`)
|
|
164
|
+
4. **Update documentation** (README.md, comments) to reflect changes
|
|
165
|
+
5. **Open a PR** describing:
|
|
166
|
+
- The motivation for the change
|
|
167
|
+
- What was changed
|
|
168
|
+
- Testing notes (WordPress version, dev/prod modes tested)
|
|
169
|
+
6. **Respond to feedback** and make requested changes
|
|
170
|
+
|
|
171
|
+
## Known Gaps (Not Done Yet)
|
|
172
|
+
|
|
173
|
+
- Additional WordPress template files (single.php, page.php, archive.php)
|
|
174
|
+
- WordPress block editor (Gutenberg) styles and support
|
|
175
|
+
- Image optimization pipeline
|
|
176
|
+
- Multi-language/i18n setup examples
|
|
177
|
+
- Custom post type examples
|
|
178
|
+
- WooCommerce integration example
|
|
179
|
+
|
|
180
|
+
## Questions or Issues?
|
|
181
|
+
|
|
182
|
+
Please open an issue or discussion on GitHub if you're unsure about the best approach for a change. Coordinating early avoids conflicts with:
|
|
183
|
+
|
|
184
|
+
- Build configuration
|
|
185
|
+
- WordPress compatibility
|
|
186
|
+
- Template structure
|
|
187
|
+
|
|
188
|
+
## Code of Conduct
|
|
189
|
+
|
|
190
|
+
This project adheres to the [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 PHCDevworks
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
# @phcdevworks/spectre-shell-wordpress
|
|
2
|
+
|
|
3
|
+
A reusable template for building modern WordPress themes with Vite, TypeScript, and Tailwind CSS 4. Features HMR, manifest-based asset loading, and seamless dev/prod mode switching for rapid WordPress theme development.
|
|
4
|
+
|
|
5
|
+
🤝 **[Contributing Guide](CONTRIBUTING.md)** | 📝 **[Changelog](CHANGELOG.md)**
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`@phcdevworks/spectre-shell-wordpress` is a starter template that brings modern frontend tooling to WordPress theme development. It uses Vite for fast builds and HMR, TypeScript for type safety, and Tailwind CSS 4 for utility-first styling.
|
|
10
|
+
|
|
11
|
+
- ✅ Vite-powered development with instant HMR
|
|
12
|
+
- ✅ TypeScript for type-safe theme development
|
|
13
|
+
- ✅ Tailwind CSS 4 with modern `@import` syntax
|
|
14
|
+
- ✅ Automatic dev/prod mode detection via `WP_ENV`
|
|
15
|
+
- ✅ Manifest-based asset loading with cache-busting
|
|
16
|
+
- ✅ WordPress-optimized build output to `spectre-theme/dist/`
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Clone or use this template
|
|
22
|
+
git clone https://github.com/phcdevworks/spectre-shell-wordpress.git
|
|
23
|
+
cd spectre-shell-wordpress
|
|
24
|
+
|
|
25
|
+
# Install dependencies
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### 1. Configure WordPress Environment
|
|
32
|
+
|
|
33
|
+
Set up your WordPress installation to work with the Vite dev server:
|
|
34
|
+
|
|
35
|
+
```php
|
|
36
|
+
// wp-config.php
|
|
37
|
+
define('WP_ENV', 'development'); // Enable dev mode
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**How it works:**
|
|
41
|
+
|
|
42
|
+
- **Development mode**: Assets load from Vite dev server (http://localhost:5173) with HMR
|
|
43
|
+
- **Production mode**: Assets load from `spectre-theme/dist/` with manifest-based cache-busting
|
|
44
|
+
|
|
45
|
+
### 2. Start Development Server
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm run dev
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This starts the Vite dev server on http://localhost:5173 with HMR enabled. Edit files in `src/` and see changes instantly in your browser.
|
|
52
|
+
|
|
53
|
+
### 3. Activate Theme in WordPress
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Copy or symlink theme folder to WordPress
|
|
57
|
+
cp -r spectre-theme /path/to/wordpress/wp-content/themes/spectre-shell
|
|
58
|
+
# Or create a symlink for development
|
|
59
|
+
ln -s $(pwd)/spectre-theme /path/to/wordpress/wp-content/themes/spectre-shell
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Then activate the theme in WordPress admin.
|
|
63
|
+
|
|
64
|
+
### 4. Build for Production
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm run build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This compiles TypeScript, processes CSS with Tailwind, and outputs optimized assets to `spectre-theme/dist/` with a manifest for cache-busting.
|
|
71
|
+
|
|
72
|
+
**Deploy:** Upload the `spectre-theme/` folder to your WordPress installation.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
## Theme Customization
|
|
76
|
+
|
|
77
|
+
### Update Theme Metadata
|
|
78
|
+
|
|
79
|
+
Edit `spectre-theme/style.css` with your theme details:
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
/*
|
|
83
|
+
Theme Name: Your Theme Name
|
|
84
|
+
Theme URI: https://yoursite.com
|
|
85
|
+
Author: Your Name
|
|
86
|
+
Description: Your amazing WordPress theme
|
|
87
|
+
Text Domain: your-theme-slug
|
|
88
|
+
*/
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Replace Function Prefixes
|
|
92
|
+
|
|
93
|
+
Find and replace in `spectre-theme/functions.php`:
|
|
94
|
+
|
|
95
|
+
- `spectre_shell` → `your_theme_slug`
|
|
96
|
+
- Function names (e.g., `spectre_shell_setup` → `yourtheme_setup`)
|
|
97
|
+
|
|
98
|
+
### Customize Styles
|
|
99
|
+
|
|
100
|
+
Edit `src/styles/main.css`:
|
|
101
|
+
|
|
102
|
+
```css
|
|
103
|
+
@import "tailwindcss";
|
|
104
|
+
|
|
105
|
+
/* Your custom styles */
|
|
106
|
+
:root {
|
|
107
|
+
--font-sans: system-ui, sans-serif;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
body {
|
|
111
|
+
@apply antialiased;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* WordPress alignment classes */
|
|
115
|
+
.alignleft {
|
|
116
|
+
@apply float-left mr-4;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Add JavaScript
|
|
121
|
+
|
|
122
|
+
Edit `src/js/main.ts`:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
import "../styles/main.css";
|
|
126
|
+
|
|
127
|
+
// Your TypeScript code
|
|
128
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
129
|
+
console.log("Theme loaded!");
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Tailwind Configuration
|
|
134
|
+
|
|
135
|
+
Customize `tailwind.config.ts`:
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
import type { Config } from "tailwindcss";
|
|
139
|
+
|
|
140
|
+
export default {
|
|
141
|
+
content: ["./spectre-theme/**/*.php", "./src/**/*.{js,ts,jsx,tsx}"],
|
|
142
|
+
theme: {
|
|
143
|
+
extend: {
|
|
144
|
+
colors: {
|
|
145
|
+
primary: "#your-color",
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
} satisfies Config;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Project Structure
|
|
153
|
+
|
|
154
|
+
| Folder | Responsibility |
|
|
155
|
+
| ------------- | -------------------------------------------------------------------- |
|
|
156
|
+
| `src/` | TypeScript and CSS source files compiled by Vite |
|
|
157
|
+
| `src/js/` | JavaScript/TypeScript entry points |
|
|
158
|
+
| `src/styles/` | CSS files with Tailwind imports |
|
|
159
|
+
| `spectre-theme/` | WordPress theme files (PHP templates, functions.php, style.css) |
|
|
160
|
+
| `spectre-theme/dist/` | Generated build artifacts (CSS, JS, manifest) - auto-created by Vite |
|
|
161
|
+
|
|
162
|
+
**Source files** live in `src/` and compile to `spectre-theme/dist/`. Only the `spectre-theme/` folder gets deployed to WordPress.
|
|
163
|
+
|
|
164
|
+
## Asset Loading
|
|
165
|
+
|
|
166
|
+
### Development Mode
|
|
167
|
+
|
|
168
|
+
When `WP_ENV` is set to `development`, `spectre-theme/functions.php` loads assets from the Vite dev server:
|
|
169
|
+
|
|
170
|
+
```php
|
|
171
|
+
wp_enqueue_script(
|
|
172
|
+
'vite-client',
|
|
173
|
+
'http://localhost:5173/@vite/client',
|
|
174
|
+
array(),
|
|
175
|
+
null,
|
|
176
|
+
false
|
|
177
|
+
);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Changes to source files trigger instant browser updates via HMR.
|
|
181
|
+
|
|
182
|
+
### Production Mode
|
|
183
|
+
|
|
184
|
+
In production, assets load from the manifest file at `spectre-theme/dist/.vite/manifest.json`:
|
|
185
|
+
|
|
186
|
+
```php
|
|
187
|
+
$manifest = json_decode(file_get_contents(get_template_directory() . '/dist/.vite/manifest.json'), true);
|
|
188
|
+
|
|
189
|
+
if (isset($manifest['src/styles/main.css'])) {
|
|
190
|
+
$css_file = $manifest['src/styles/main.css']['file'];
|
|
191
|
+
wp_enqueue_style('theme-style', get_template_directory_uri() . '/dist/' . $css_file);
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Hashed filenames ensure cache-busting on updates.
|
|
196
|
+
|
|
197
|
+
## WordPress Theme Templates
|
|
198
|
+
|
|
199
|
+
Add standard WordPress templates to the `spectre-theme/` folder:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
spectre-theme/
|
|
203
|
+
├── single.php # Single post template
|
|
204
|
+
├── page.php # Page template
|
|
205
|
+
├── archive.php # Archive template
|
|
206
|
+
├── 404.php # 404 error page
|
|
207
|
+
├── search.php # Search results
|
|
208
|
+
└── sidebar.php # Sidebar
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
All templates have access to enqueued Vite assets automatically.
|
|
212
|
+
|
|
213
|
+
## Build & Release
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm run build
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The build process:
|
|
220
|
+
|
|
221
|
+
1. **TypeScript compilation** - Compiles `src/js/` to optimized JavaScript
|
|
222
|
+
2. **CSS processing** - Processes `src/styles/` with Tailwind and PostCSS
|
|
223
|
+
3. **Asset optimization** - Minifies and generates hashed filenames
|
|
224
|
+
4. **Manifest generation** - Creates `.vite/manifest.json` for asset lookup
|
|
225
|
+
|
|
226
|
+
Output goes to `spectre-theme/dist/` and is ready for WordPress deployment.
|
|
227
|
+
|
|
228
|
+
For release history and version notes, see the **[Changelog](CHANGELOG.md)**.
|
|
229
|
+
|
|
230
|
+
## Development Philosophy
|
|
231
|
+
|
|
232
|
+
This template follows a **build tool first** approach:
|
|
233
|
+
|
|
234
|
+
### 1. Build Configuration (Vite + Tailwind)
|
|
235
|
+
|
|
236
|
+
**Purpose**: Asset compilation pipeline for WordPress themes
|
|
237
|
+
|
|
238
|
+
**Outputs**: Compiled CSS and JavaScript to `spectre-theme/dist/` with manifest
|
|
239
|
+
|
|
240
|
+
**Rules**:
|
|
241
|
+
|
|
242
|
+
- Vite handles all asset compilation and HMR
|
|
243
|
+
- Tailwind provides utility-first CSS framework
|
|
244
|
+
- All source files must go through Vite
|
|
245
|
+
|
|
246
|
+
### 2. Source Assets (src/)
|
|
247
|
+
|
|
248
|
+
**Purpose**: Development files for TypeScript and CSS
|
|
249
|
+
|
|
250
|
+
**Contains**:
|
|
251
|
+
|
|
252
|
+
- `main.ts` - JavaScript entry point
|
|
253
|
+
- `main.css` - CSS entry with Tailwind imports
|
|
254
|
+
- Optional component organization
|
|
255
|
+
|
|
256
|
+
**Rules**:
|
|
257
|
+
|
|
258
|
+
- Use TypeScript for type safety
|
|
259
|
+
- Import Tailwind via `@import 'tailwindcss'`
|
|
260
|
+
- Never ship raw source to production
|
|
261
|
+
|
|
262
|
+
### 3. WordPress Theme (spectre-theme/)
|
|
263
|
+
|
|
264
|
+
**Purpose**: WordPress templates and functions that load Vite assets
|
|
265
|
+
|
|
266
|
+
**Key mechanism**:
|
|
267
|
+
|
|
268
|
+
- `functions.php` detects `WP_ENV` and switches between dev/prod
|
|
269
|
+
- Dev mode loads from Vite server with HMR
|
|
270
|
+
- Prod mode loads from manifest
|
|
271
|
+
|
|
272
|
+
**Rules**:
|
|
273
|
+
|
|
274
|
+
- PHP never defines inline styles or scripts
|
|
275
|
+
- All assets load through Vite's build system
|
|
276
|
+
- Follow WordPress coding standards
|
|
277
|
+
|
|
278
|
+
### Golden Rule (Non-Negotiable)
|
|
279
|
+
|
|
280
|
+
**Vite builds. WordPress loads. Source never ships.**
|
|
281
|
+
|
|
282
|
+
WordPress themes ship only compiled assets from `dist/`, never raw source files.
|
|
283
|
+
|
|
284
|
+
- If it's a build config → belongs in `vite.config.ts` or `tailwind.config.ts`
|
|
285
|
+
- If it's source code → belongs in `src/`
|
|
286
|
+
- If it's WordPress PHP → belongs in `spectre-theme/`
|
|
287
|
+
|
|
288
|
+
## Design Principles
|
|
289
|
+
|
|
290
|
+
1. **Fast development** - HMR and Vite dev server for instant feedback
|
|
291
|
+
2. **Type-safe** - TypeScript catches errors before runtime
|
|
292
|
+
3. **Modern CSS** - Tailwind CSS 4 with utility-first approach
|
|
293
|
+
4. **WordPress-native** - Standard WordPress functions and hooks
|
|
294
|
+
5. **Production-ready** - Optimized builds with cache-busting
|
|
295
|
+
|
|
296
|
+
## TypeScript Support
|
|
297
|
+
|
|
298
|
+
Type definitions are included for Vite and WordPress globals:
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
// vite-env.d.ts
|
|
302
|
+
/// <reference types="vite/client" />
|
|
303
|
+
|
|
304
|
+
interface ImportMetaEnv {
|
|
305
|
+
readonly VITE_SOME_KEY: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
interface ImportMeta {
|
|
309
|
+
readonly env: ImportMetaEnv;
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Part of the Spectre Suite
|
|
314
|
+
|
|
315
|
+
- **Spectre Tokens** - Design token foundation
|
|
316
|
+
- **Spectre UI** - Core styling layer
|
|
317
|
+
- **Spectre Shell WordPress** - WordPress theme template (this package)
|
|
318
|
+
- **Spectre Blocks** - WordPress block library
|
|
319
|
+
- **Spectre Astro** - Astro integration
|
|
320
|
+
|
|
321
|
+
## Contributing
|
|
322
|
+
|
|
323
|
+
Issues and pull requests are welcome. For theme template improvements, test both dev and production modes.
|
|
324
|
+
|
|
325
|
+
For detailed contribution guidelines, see **[CONTRIBUTING.md](CONTRIBUTING.md)**.
|
|
326
|
+
|
|
327
|
+
## License
|
|
328
|
+
|
|
329
|
+
MIT © PHCDevworks — See **[LICENSE](LICENSE)** for details.
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## ❤️ Support Spectre
|
|
334
|
+
|
|
335
|
+
If Spectre Shell WordPress helps your workflow, consider sponsoring:
|
|
336
|
+
|
|
337
|
+
- [GitHub Sponsors](https://github.com/sponsors/phcdevworks)
|
|
338
|
+
- [Buy Me a Coffee](https://buymeacoffee.com/phcdevworks)
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We aim to support the latest published version of Spectre Shell WordPress. Security updates are applied to the current major version only.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.x.x | :white_check_mark: |
|
|
10
|
+
| < 1.0 | :x: |
|
|
11
|
+
|
|
12
|
+
**Please ensure you are using the most recent version** of both:
|
|
13
|
+
|
|
14
|
+
- This template
|
|
15
|
+
- `vite` and other dependencies (updated in `package.json`)
|
|
16
|
+
|
|
17
|
+
Older releases may not receive security fixes.
|
|
18
|
+
|
|
19
|
+
## Reporting a Vulnerability
|
|
20
|
+
|
|
21
|
+
If you discover a security vulnerability, please **DO NOT** open a public issue. Security issues should be reported privately to protect users.
|
|
22
|
+
|
|
23
|
+
### How to Report
|
|
24
|
+
|
|
25
|
+
**Preferred method**: Use [GitHub Security Advisories](https://github.com/phcdevworks/spectre-shell-wordpress/security/advisories/new) to privately report vulnerabilities
|
|
26
|
+
|
|
27
|
+
**Alternative methods**:
|
|
28
|
+
|
|
29
|
+
- Email the maintainers at [security contact - see repository]
|
|
30
|
+
- Direct message maintainers through GitHub
|
|
31
|
+
|
|
32
|
+
### What to Include
|
|
33
|
+
|
|
34
|
+
Please provide as much detail as possible to help us reproduce and assess impact:
|
|
35
|
+
|
|
36
|
+
1. **Description of the vulnerability** and potential impact
|
|
37
|
+
2. **Steps to reproduce** or proof-of-concept code
|
|
38
|
+
3. **Affected versions** (if known)
|
|
39
|
+
4. **Potential attack scenarios**
|
|
40
|
+
5. **Suggested mitigation** (if you have ideas)
|
|
41
|
+
|
|
42
|
+
### What to Expect
|
|
43
|
+
|
|
44
|
+
1. **Acknowledgment**: We will acknowledge receipt within **48 hours**
|
|
45
|
+
2. **Assessment**: We will investigate and provide an initial assessment within **5 business days**
|
|
46
|
+
3. **Updates**: We will keep you informed of the fix status throughout the process
|
|
47
|
+
4. **Resolution**: We will work on a fix and coordinate disclosure timing with you
|
|
48
|
+
5. **Credit**: We will credit you in the security advisory (unless you prefer to remain anonymous)
|
|
49
|
+
|
|
50
|
+
## Responsible Disclosure
|
|
51
|
+
|
|
52
|
+
We appreciate responsible disclosure and will work with you to:
|
|
53
|
+
|
|
54
|
+
- Understand the scope and severity of the issue
|
|
55
|
+
- Develop and test a fix
|
|
56
|
+
- Coordinate public disclosure timing
|
|
57
|
+
- Credit your contribution (if desired)
|
|
58
|
+
|
|
59
|
+
**Please allow us reasonable time to address the issue before public disclosure.**
|
|
60
|
+
|
|
61
|
+
## Security Best Practices
|
|
62
|
+
|
|
63
|
+
When using Spectre Shell WordPress:
|
|
64
|
+
|
|
65
|
+
1. **Keep dependencies updated** to the latest versions
|
|
66
|
+
2. **Monitor dependencies** for known vulnerabilities (`npm audit`)
|
|
67
|
+
3. **Use HTTPS** for all production sites
|
|
68
|
+
4. **Follow WordPress security best practices** for theme development
|
|
69
|
+
5. **Sanitize user input** in WordPress templates
|
|
70
|
+
|
|
71
|
+
## Scope
|
|
72
|
+
|
|
73
|
+
This security policy covers:
|
|
74
|
+
|
|
75
|
+
- The Spectre Shell WordPress template code
|
|
76
|
+
- Build configuration and compilation
|
|
77
|
+
- WordPress theme asset loading
|
|
78
|
+
- TypeScript source files
|
|
79
|
+
|
|
80
|
+
This policy does **NOT** cover:
|
|
81
|
+
|
|
82
|
+
- Vulnerabilities in WordPress core (report to [WordPress HackerOne](https://hackerone.com/wordpress))
|
|
83
|
+
- Issues in Vite, Tailwind, or other dependencies (report to their maintainers)
|
|
84
|
+
- WordPress plugin vulnerabilities
|
|
85
|
+
- Server configuration issues
|
|
86
|
+
|
|
87
|
+
## Contact
|
|
88
|
+
|
|
89
|
+
For security-related questions that aren't vulnerabilities:
|
|
90
|
+
|
|
91
|
+
- Open a [GitHub Discussion](https://github.com/phcdevworks/spectre-shell-wordpress/discussions)
|
|
92
|
+
- Tag maintainers in relevant issues
|
|
93
|
+
|
|
94
|
+
Thank you for helping keep this template and our community safe!
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>spectre-shell-wordpress</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="app"></div>
|
|
11
|
+
<script type="module" src="/src/main.ts"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|