From 2b2e863c84225e8f318e9b492e9faa7d0ca8c7b5 Mon Sep 17 00:00:00 2001 From: mlaetitia <30905719+mlaetitia@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:45:01 -0500 Subject: [PATCH 1/2] Small fixes to the readme instructions to specify the code must be run on the plugins folder --- readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 7f38b2b..595534e 100644 --- a/readme.md +++ b/readme.md @@ -10,9 +10,9 @@ Your plugin must have an entrypoint with the same name as the folder, i.e. `hell ## Creating a new block -You can add a new block to the monorepo by running the following steps in any folder: +You can add a new block to the monorepo by running the following steps. Make sure you're starting from the `wp-content/plugins` folder: -``` +``` bash git clone --no-checkout --sparse https://github.com/a8cteam51/special-projects-blocks-monorepo/ cd special-projects-blocks-monorepo npx @wordpress/create-block @@ -37,7 +37,7 @@ From here, you can start editing your block. Start by downloading the block's zip file on your plugin folder -``` +``` bash git clone --no-checkout --sparse https://github.com/a8cteam51/special-projects-blocks-monorepo/ cd special-projects-blocks-monorepo git sparse-checkout init --cone From 9e623227a4fe36db6f75bb49b2b8dc79d0b5c642 Mon Sep 17 00:00:00 2001 From: mlaetitia <30905719+mlaetitia@users.noreply.github.com> Date: Sat, 23 Mar 2024 16:23:59 -0500 Subject: [PATCH 2/2] adds more info to the README and changes the hook being used to load the blocks from init to plugins loaded --- readme.md | 33 +++++++++++++++++++++++----- special-projects-blocks-monorepo.php | 12 +++++----- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/readme.md b/readme.md index 595534e..51548f6 100644 --- a/readme.md +++ b/readme.md @@ -8,6 +8,22 @@ Your plugin *must* contain a `CHANGELOG.md` file. Your plugin must have an entrypoint with the same name as the folder, i.e. `hello-world/hello-world.php`. +## Introduction + +To work on this repository we advise the use of the following instructions. Using `git sparse-checkout` will make sure you'll only download and work on files related to a specific block. + +### Sparse Checkout + +The instructions will show you how to use sparse-checkout to work on a single block. You can work on extra blocks on your site by running + +`git sparse-checkout add %block_name%` + +If you need to remove sparse-checkout functionality altogether, you can run: + +`git sparse-checkout disable` + +More information here: https://git-scm.com/docs/git-sparse-checkout + ## Creating a new block You can add a new block to the monorepo by running the following steps. Make sure you're starting from the `wp-content/plugins` folder: @@ -28,10 +44,9 @@ git push ``` -From here, you can start editing your block. - +From here, you can start editing your block and follow the regular process to do so. -## Editing an existing block +## Checkout and edit an existing block **Do not forget that changing a block will auto update it on all sites that use this block. Please be careful!** @@ -54,6 +69,14 @@ When updating a **static** block — if we add any changes to the edit or save f ## Partner Agnostic -Make sure that project-specific styles and data go into the project code and not the block in this repo +Keep in mind that blocks in this repository can be installed on multiple sites. + +When you need to make any changes, make sure those changes (design and/or functionality) are applicable to any other sites and are improving upon the existing code. + +Make sure that project-specific styles and data go into the project code and not the block code in this repo . + +### Adding site / partner specific styles + +Any partner-specific styling rules should be added via a separate stylesheet that should be registered through https://developer.wordpress.org/themes/features/block-stylesheets/#registering-a-block-stylesheet -https://developer.wordpress.org/themes/features/block-stylesheets/#registering-a-block-stylesheet +### Adding site / partner specific styles \ No newline at end of file diff --git a/special-projects-blocks-monorepo.php b/special-projects-blocks-monorepo.php index ff06149..807c479 100644 --- a/special-projects-blocks-monorepo.php +++ b/special-projects-blocks-monorepo.php @@ -1,7 +1,7 @@