Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ This is the LightSpeed Site Plugin — custom blocks and site-specific functiona
| Main plugin bootstrap | `ls-plugin.php` |
| PHP includes | `inc/` |
| Block source files | `src/blocks/` |
| Built block assets | `blocks/` |
| Static assets | `assets/` |
| JS/CSS source files | `src/js/`, `src/css/` |
| Built CSS/JS assets | `build/` |
| Static non-compiled assets | `assets/` |
| Block patterns | `patterns/` |
| Translation files | `languages/` |
| End-user docs | `docs/` |
Expand Down Expand Up @@ -69,12 +70,20 @@ See `.github/instructions/` for detailed guidance:
## Validation and linting

```bash
npm run build # Build all source JS/CSS assets from src/ into build/
npm run plugin:validate # Validate plugin structure
npm run security:scan # PHP security scan
composer run phpcs # PHP coding standards
npm run lint # JS + CSS + JSON linting
```

## Asset build rule

- Add authored JS and CSS files under `src/`.
- Run `npm run build` after changing JS or CSS.
- Enqueue or include only files from `build/` in PHP.
- Do not treat `assets/js/` or `assets/css/` as source directories.

---

## Accessibility
Expand Down
26 changes: 15 additions & 11 deletions .github/instructions/assets.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,24 @@ applyTo: "assets/**,src/**"

| Folder | Content |
| ---------------- | ------------------------------------------------------ |
| `assets/css/` | Static (pre-built) CSS files for frontend or admin |
| `assets/js/` | Static (pre-built) JS files not managed by block build |
| `assets/css/` | Static non-source assets only; do not add authored CSS source here |
| `assets/js/` | Static non-source assets only; do not add authored JS source here |
| `assets/images/` | Plugin images (logos, backgrounds, etc.) |
| `assets/icons/` | SVG or PNG icons |
| `src/blocks/` | Block source files — compiled by `@wordpress/scripts` |
| `src/css/` | Non-block CSS source files |
| `src/js/` | Non-block JS source files |
| `blocks/` | Built block assets output of `npm run build` |
| `src/css/` | Non-block CSS source files for the build pipeline |
| `src/js/` | Non-block JS source files for the build pipeline |
| `build/` | Built CSS/JS assets output by `npm run build` |

## Rules

- Do not mix source and built files in the same folder.
- Put authored JS and CSS source files in `src/`, not `assets/`.
- `src/` contains files that need compilation.
- `assets/` contains files that are already production-ready.
- `blocks/` contains built block output from `@wordpress/scripts`.
- Do not commit compiled output from `src/` — use `npm run build` to generate it.
- `build/` contains the generated files that are enqueued or included by PHP.
- Treat `assets/` as static non-compiled assets only, such as images or icons.
- After changing JS or CSS in `src/`, run `npm run build` to regenerate the `build/` output.
- Do not enqueue or include JS/CSS directly from `src/`.

## WordPress preset syntax

Expand All @@ -32,20 +34,22 @@ applyTo: "assets/**,src/**"

## Enqueuing assets in PHP

Use `wp_enqueue_style()` and `wp_enqueue_script()` with versioning:
Use `wp_enqueue_style()` and `wp_enqueue_script()` with versioning, and point them at built files:

```php
wp_enqueue_style(
'ls-plugin-frontend',
LS_PLUGIN_PLUGIN_URL . 'assets/css/frontend.css',
LS_PLUGIN_PLUGIN_URL . 'build/css/frontend.css',
[],
LS_PLUGIN_VERSION
);
```

When webpack generates `*.asset.php` metadata files, use them for dependencies and versions.

## Block assets

Block assets (editor and frontend CSS/JS) are declared in `block.json` and enqueued automatically by `register_block_type()`.
Block assets (editor and frontend CSS/JS) are declared in `block.json` and built into `build/`, then enqueued automatically by `register_block_type()`.
Do not manually enqueue block scripts — let `block.json` handle it.

## Image and icon guidelines
Expand Down
6 changes: 4 additions & 2 deletions .github/instructions/plugin-structure.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ applyTo: "**"
|---|---|
| `inc/` | Optional PHP include files — loaded from main plugin file |
| `src/` | Source files for compilation (blocks, CSS, JS) |
| `blocks/` | Built block assets — output of `npm run build` |
| `assets/` | Static (pre-built) CSS, JS, images, icons |
| `build/` | Built CSS/JS assets — output of `npm run build` |
| `assets/` | Static non-compiled assets such as images and icons |
| `patterns/` | WordPress block patterns (PHP with header comments) |
| `templates/` | Optional block templates and template parts |
| `languages/` | Translation files (.pot, .po, .mo) |
Expand All @@ -51,6 +51,8 @@ Plugin-specific values are already set for this repo:

- Do not put developer reports in `docs/`.
- Do not put built assets in `src/`.
- Do not add authored JS or CSS source files to `assets/`.
- Do not enqueue raw files from `src/`; build them first and include the generated files from `build/`.
- Do not add Playwright, Storybook, Docker, webpack config, or Vite.
- Do not add a PHP autoloader unless there is a genuine reason.
- Do not add issue templates or pull request templates.
91 changes: 91 additions & 0 deletions .github/schemas/scf-field-group.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://lightspeedwp.agency/schemas/scf-field-group.schema.json",
"title": "SCF Field Group",
"description": "Schema for Secure Custom Fields field group JSON exports.",
"type": "object",
"required": [
"key",
"title",
"fields",
"location"
],
"properties": {
"key": {
"type": "string",
"pattern": "^group_"
},
"title": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "object",
"required": ["key", "type"],
"properties": {
"key": {
"type": "string"
},
"type": {
"type": "string"
},
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"sub_fields": {
"type": "array"
},
"layouts": {
"type": "array"
}
},
"additionalProperties": true
}
},
"location": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "object",
"required": ["param", "operator", "value"],
"properties": {
"param": {
"type": "string"
},
"operator": {
"type": "string"
},
"value": {
"type": ["string", "number", "boolean"]
}
},
"additionalProperties": true
}
}
},
"position": {
"type": "string"
},
"style": {
"type": "string"
},
"label_placement": {
"type": "string"
},
"instruction_placement": {
"type": "string"
},
"hide_on_screen": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": true
}
12 changes: 8 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Responsibilities:
├── readme.txt Lightweight WordPress distribution placeholder
├── inc/ PHP include files (optional, loaded from main plugin file)
├── src/ Source files: src/blocks/, src/css/, src/js/
├── blocks/ Built or registered block asset directories
├── assets/ Static assets: assets/css/, assets/js/, assets/images/, assets/icons/
├── build/ Built CSS/JS assets generated by npm build
├── assets/ Static non-compiled assets: images, icons, other fixed files
├── patterns/ WordPress block patterns (PHP files with header comments)
├── templates/ Optional block templates and template parts
├── languages/ Translation files (.pot, .po, .mo)
Expand Down Expand Up @@ -137,11 +137,15 @@ register_block_type( LS_PLUGIN_PLUGIN_DIR . 'blocks/my-block' );

## Asset Conventions

- **Static assets** (ready-to-use CSS, JS, images, icons): `assets/`
- **Source files** (need compilation): `src/`
- **Built block assets**: `blocks/`
- **Built CSS/JS assets**: `build/`
- **Static non-compiled assets** (images, icons, fixed files): `assets/`
- Do not mix source and built assets in the same folder.
- Frontend CSS and editor CSS should be separate files where appropriate.
- Add authored JS and CSS to `src/js/`, `src/css/`, or `src/blocks/`.
- Run `npm run build` after changing JS or CSS source files.
- PHP must enqueue or include built assets from `build/`, never raw source files from `src/`.
- Do not add authored JS or CSS source files to `assets/js/` or `assets/css/`.

---

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added a Button Icon selector panel for core Button blocks, including left/right positioning and up/down icon options.
- Added a Back to Top option as a `core/button` variation so users inherit native Button styling controls and icon compatibility.
- Added smooth scrolling support for Back to Top button clicks and internal anchor links using vanilla JavaScript.

- Linkable Group Blocks support for `core/group`, `core/column`, and `core/cover`, including custom URLs and current-post linking from the block toolbar.
- Added plugin-managed SCF Local JSON handling and validation utilities for field groups, post types, and taxonomies.
- Added an SCF field-group schema for repository validation workflows.
- Added SCF JSON definitions for a Portfolio post type, Industry and Service taxonomies, and Portfolio custom fields.
- Added SCF permalink controls on the WordPress Permalinks screen for portfolio archives and related taxonomies.

### Changed
- Changed Back to Top implementation from a standalone custom block to a `core/button` variation.
- Changed Back to Top frontend targeting to use a dedicated wrapper class (`is-back-to-top`) for reliable JS and CSS behaviour.
- Changed Back to Top visibility to always display (removed scroll-threshold hide/show behaviour).
- Changed linkable block source assets to load from `src/` and updated build configuration to match the new asset layout.
- Changed the plugin bootstrap to load SCF JSON configuration, validation, and permalink management classes.

### Deprecated

Expand Down
Loading