Skip to content

Commit

Permalink
Merge pull request #222 from alleyinteractive/feature/AOS-40/scaffold…
Browse files Browse the repository at this point in the history
…-slotfill

AOS-40 - Include create-entry script to scaffold slotfills and entries
  • Loading branch information
stevenslack authored Aug 29, 2023
2 parents 72082a7 + 3e45f86 commit ad9f522
Show file tree
Hide file tree
Showing 12 changed files with 1,143 additions and 297 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,24 @@ Run `composer test` to run tests against PHPUnit and the PHP code in the plugin.

All directories created in the `entries` directory can serve as entry points and will be compiled with [@wordpress/scripts](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/README.md#scripts) into the `build` directory with an accompanied `index.asset.php` asset map.

#### Scaffolding an entry point

To generate a new entry point, run the following command:
```sh
npm run create-entry
```

To generate a new slotfill, run the following command:
```sh
npm run create-slotfill
```

The command will prompt the user through several options for creating an entry or slotfill. The entries are scaffolded with the `@alleyinteractive/create-entry` script. Run the help command to see all the options:
```sh
npx @alleyinteractive/create-entry --help
```
[Visit the package README](https://www.npmjs.com/package/@alleyinteractive/create-entry) for more information.

#### Enqueuing Entry Points

You can also include an `index.php` file in the entry point directory for enqueueing or registering a script. This file will then be moved to the build directory and will be auto-loaded with the `load_scripts()` function in the `functions.php` file. Alternatively, if a script is to be enqueued elsewhere there are helper functions in the `src/assets.php` file for getting the assets.
Expand Down
File renamed without changes.
7 changes: 0 additions & 7 deletions entries/example-entry/index.scss

This file was deleted.

8 changes: 0 additions & 8 deletions entries/example-entry/index.ts

This file was deleted.

59 changes: 0 additions & 59 deletions entries/example-slotfills/index.php

This file was deleted.

17 changes: 0 additions & 17 deletions entries/example-slotfills/index.scss

This file was deleted.

10 changes: 0 additions & 10 deletions entries/example-slotfills/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
const { defaults: tsjPreset } = require('ts-jest/presets');

module.exports = {
Expand Down
Loading

0 comments on commit ad9f522

Please sign in to comment.