Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit ba5e0bd

Browse files
committed
Adds a missing step from the theme core migration documentation.
1 parent 8bdd244 commit ba5e0bd

1 file changed

Lines changed: 28 additions & 13 deletions

File tree

docs/migrating-from-theme-core.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,29 @@ Using composer, remove the theme core from your project.
2727
composer remove creode/theme-core
2828
```
2929

30-
### 4: Remove the requirement of the theme-core boot file
30+
### 4: Remove the installer path for theme core
31+
In your composer.json file remove the following line:
32+
33+
```jsonc
34+
{
35+
// ... other composer.json code ...
36+
"extra": { // [!code --]
37+
"installer-paths": { // [!code --]
38+
"wp-content/themes/gibraltar-international-bank/core/": ["type:wordpress-themecore"] // [!code --]
39+
} // [!code --]
40+
} // [!code --]
41+
// ... other composer.json code ...
42+
}
43+
```
44+
45+
### 5: Remove the requirement of the theme-core boot file
3146
Remove the following line from your `functions.php` file.
3247

3348
```php
3449
require_once get_template_directory() . '/core/boot.php'; // [!code --]
3550
```
3651

37-
### 5: Replace class of register_vite_script function
52+
### 6: Replace class of register_vite_script function
3853
The assets class from theme core has been removed and instead is now replaced with a function from the new theme framework.
3954

4055
You will need to replace all occurrences and function calls:
@@ -54,7 +69,7 @@ add_action( 'wp_enqueue_scripts', '[[THEME_NAME]]_enqueue_script' );
5469

5570
This will now ensure that all JS is loaded from Vite correctly.
5671

57-
### 6: Remove hot reloading from your vite config file.
72+
### 7: Remove hot reloading from your vite config file.
5873
Hot reloading was a feature that was a little buggy on the theme core. It is therefore no longer supported in the new theme framework. There may be plans in future to reintroduce this feature.
5974

6075
In order to remove hot reloading, you will need to remove the following line from your vite config file.
@@ -71,12 +86,12 @@ export default defineConfig(
7186
);
7287
```
7388

74-
### 7: Move your SCSS folder up a level
89+
### 8: Move your SCSS folder up a level
7590
In the previous version of the theme core framework, the SCSS folder was located within the `src` folder. As part of this migration, you will need to move the SCSS folder up a level to the root of the project. The `SCSS` folder should now be located in the root of the theme.
7691

7792
For example if you had a `src/scss` folder in the theme, it should now be moved to the root of the theme to `scss/`.
7893

79-
### 8: Migrate the component specific CSS files up to the component directory
94+
### 9: Migrate the component specific CSS files up to the component directory
8095
As part of the changes to how blocks are handled, the SCSS files for each block should now be moved to their relevant block folder.
8196

8297
For example a header.scss component file will now be located in the following folder based on the theme root: `/blocks/header-block/assets/header.scss`.
@@ -85,7 +100,7 @@ Each of these components should be moved to their relevant block folder.
85100

86101
This is a change that will need to be done manually and can be quite tedious however it will ensure that all themes and blocks are kept consistent in the future.
87102

88-
### 9: Remove individual components imports from the `admin.scss` and `main.scss` files
103+
### 10: Remove individual components imports from the `admin.scss` and `main.scss` files
89104
As part of the changes to how blocks are handled, the individual components `@use` and `@include` from the `admin.scss` and `main.scss` files are no longer required. These are now handled by the theme framework and will be automatically added to the theme in a new `blocks/_all.scss` file.
90105

91106
This is a change that will need to be done manually and can be quite tedious however it will ensure that all themes and blocks are kept consistent in the future.
@@ -95,7 +110,7 @@ You can recompile the assets to check over your changes periodically during this
95110
wp creode-theme:build
96111
```
97112

98-
### 10: Clean up scss import paths
113+
### 11: Clean up scss import paths
99114
After moving the SCSS files to their relevant block folder, you will need to clean up the `@use` paths for each of the SCSS files. Paths to scss files in vite can be absolute based on where the `vite.config.js` file is located. In this case it will be in the theme.
100115

101116
An example of this is demonstrated below with pulling the global file into the `header.scss` file:
@@ -107,13 +122,13 @@ An example of this is demonstrated below with pulling the global file into the `
107122

108123
This change can be quite tedious to do manually however we want to ensure that all themes keep the same structure and paths so a change like this will help our projects stay consistent in the future.
109124

110-
### 11: Run the script to install any framework files and compile assets
125+
### 12: Run the script to install any framework files and compile assets
111126
As part of the theme framework, there is a WordPress CLI command that will install any missing files and compile the assets. This ensures that the structure of the theme is kept consistent and that new files as part of the boilerplate can be added automatically to themes without having to keep track of them manually.
112127

113-
### 12: Remove the admin and main js files from src
128+
### 13: Remove the admin and main js files from src
114129
As part of the framework, the main.js and admin.js within the `src` folder are no longer required. These are now handled by the theme framework and will be automatically added to the theme in a new `vite-entry-points` folder. These files are no longer required and can be removed from the `src` folder, if there is more content to them, ensure this is now merged with the newly created equivalent files in the `vite-entry-points` folder.
115130

116-
### 13: Update the vite config file to switch these entrypoints over
131+
### 14: Update the vite config file to switch these entrypoints over
117132
The `vite.config.js` file will need to be updated to switch these entrypoints over to the new `vite-entry-points` folder.
118133

119134
```js
@@ -139,7 +154,7 @@ export default defineConfig(
139154
```
140155

141156

142-
### 14: Import the new `blocks/_all.scss` file into the main.scss file
157+
### 15: Import the new `blocks/_all.scss` file into the main.scss file
143158
Add the following to the top of the `main.scss` file:
144159

145160
```scss
@@ -160,7 +175,7 @@ Add the following to the top of the `main.scss` file:
160175

161176
This will ensure that all blocks are loaded into the theme.
162177

163-
### 15: Import the new `blocks/_all.scss` file into the admin.scss file
178+
### 16: Import the new `blocks/_all.scss` file into the admin.scss file
164179
This process is very similar to the `main.scss` file however you will need to ensure that any admin specific mixins are handled manually using the new folder location. The new blocks all file only handle the render mixin and admin ones will need to be handled manually. See the below example for how this has changed:
165180

166181
```scss
@@ -191,7 +206,7 @@ Add the following to the `admin.scss` file:
191206
@include blocks.render; // [!code ++]
192207
```
193208

194-
### 16: Recompile the assets
209+
### 17: Recompile the assets
195210
Once these steps have been completed, you will need to recompile the assets. This can be done by running the following WP CLI command:
196211

197212
```bash

0 commit comments

Comments
 (0)