Skip to content

Commit 2769cf2

Browse files
authored
Merge pull request #85 from NativePHP/docs/pre-and-post-build
Provide documentation on pre and postbuild hooks
2 parents 44d9f45 + ce40e1e commit 2769cf2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

resources/views/docs/desktop/1/publishing/building.md

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ your app to provide automatic updates.
2525
You should build your application for each platform you intend to support and test it on each platform _before_
2626
publishing to make sure that everything works as expected.
2727

28+
### Running commands before and after builds
29+
Many applications rely on a tool such as [Vite](https://vitejs.dev/) or [Webpack](https://webpack.js.org/) to compile their CSS and JS assets before a production build.
30+
31+
To facilitate this, NativePHP provides two hooks that you can use to run commands before and after the build process.
32+
33+
To utilise these hooks, add the following to your `config/nativephp.php` file:
34+
35+
```php
36+
'prebuild' => [
37+
'npm run build:js', // Run a command before the build
38+
'npm run build:css', // Run another command before the build
39+
],
40+
'postbuild' => [
41+
'npm run release', // Run a command after the build
42+
],
43+
```
44+
45+
These commands will be run in the root of your project directory and you can specify as many as required.
46+
2847
## Versioning
2948

3049
For every build you create, you should change the version of your application in your app's `config/nativephp.php` file.

0 commit comments

Comments
 (0)