You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: resources/views/docs/desktop/1/publishing/building.md
+19
Original file line number
Diff line number
Diff line change
@@ -25,6 +25,25 @@ your app to provide automatic updates.
25
25
You should build your application for each platform you intend to support and test it on each platform _before_
26
26
publishing to make sure that everything works as expected.
27
27
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
+
28
47
## Versioning
29
48
30
49
For every build you create, you should change the version of your application in your app's `config/nativephp.php` file.
0 commit comments