Skip to content

Commit e800ecf

Browse files
committed
Merge branch 'use-vite-instead-of-mix' into new-asset-system
2 parents 3d48284 + e6667aa commit e800ecf

File tree

27 files changed

+2427
-15477
lines changed

27 files changed

+2427
-15477
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ jobs:
128128

129129
- name: Build assets for production
130130
working-directory: 'packages/hydefront'
131-
run: npm run prod
131+
run: npm run build
132132

133133
- name: Upload artifacts
134134
uses: actions/upload-artifact@v4
@@ -164,7 +164,7 @@ jobs:
164164
run: sed -i 's/\.\/vendor\/hyde\/framework\/resources\/views\/\*\*\/\*\.blade\.php/\.\/packages\/framework\/resources\/views\/\*\*\/\*\.blade\.php/' tailwind.config.js
165165

166166
- name: Build assets for production
167-
run: npm run prod
167+
run: npm run build
168168

169169
- name: Copy compiled app.css file to HydeFront dist folder
170170
run: cp _media/app.css packages/hydefront/dist/app.css

_media/app.css

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/creating-content/managing-assets.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ With Hyde, **you don't have to do it**, in fact, you can skip this entire page i
1313
But as always with Hyde, you can customize everything if you want to.
1414

1515
Hyde ships with a complete frontend using Blade views, TailwindCSS styles, and Alpine.js interactions.
16-
Some extra custom styles are made in the HydeFront package, which is pre-installed and bundled in the pre-configured Laravel Mix.
16+
Some extra custom styles are made in the HydeFront package, which is pre-installed and bundled in the pre-configured Tailwind and Vite setup.
1717

1818
To get you started quickly, all the styles are already compiled and minified into `_media/app.css`,
1919
which will be copied to the `_site/media/app.css` directory when you run `php hyde build`.
@@ -51,22 +51,21 @@ all asset files here will get copied as they are into the `_site/media` folder.
5151
It may seem weird to have two folders for storing the compiled assets, but it is quite useful.
5252

5353
The `_site` directory is intended to be excluded from version control, while the `_media` folder is included in the
54-
version control. You are of course free to modify this behaviour by editing the `webpack.mix.js` file to change the output directory.
54+
version control. You are of course free to modify this behaviour by editing the `vite.config.js` file to change the output directory.
5555

5656
## How Do I Compile Assets?
5757

5858
First, make sure that you have installed all the NodeJS dependencies using `npm install`.
59-
Then run `npm run dev` to compile the assets. If you want to compile the assets for production, run `npm run prod`.
60-
You can also run `npm run watch` to watch for changes in the source files and recompile the assets automatically.
59+
Then run `npm run dev` to compile the assets in development mode. For production builds, run `npm run build`.
6160

6261
### How does it work?
6362

64-
Hyde uses [Laravel Mix](https://laravel-mix.com/) (which is a wrapper for [Webpack](https://webpack.js.org/)) to compile the assets.
63+
Hyde uses [Vite](https://vite.dev/) to compile assets.
6564

6665
When running the `npm run dev/prod` command, the following happens:
6766

68-
1. Laravel Mix will compile the `resources/assets/app.css` file into `_media/app.css` using PostCSS with TailwindCSS and AutoPrefixer.
69-
2. Mix then copies the `_media` folder into `_site/media`, this is so that they are automatically accessible to your site without having to rerun `php hyde build`.
67+
1. Vite will compile the `resources/assets/app.css` file into `_media/app.css` using PostCSS with TailwindCSS and AutoPrefixer.
68+
2. Vite then copies the `_media` folder into `_site/media`, this is so that they are automatically accessible to your site without having to rerun `php hyde build`.
7069

7170
## Telling Hyde where to find assets
7271

@@ -102,7 +101,7 @@ set `use_play_cdn` to `true` in the `config/hyde.php` file. This will in additio
102101
also add a script tag which loads the TailwindCSS Play CDN.
103102

104103
What's even better is that Hyde will also inject the contents of the included `tailwind.config.js` file into the script tag,
105-
so the Play CDN styles match the ones created by Laravel Mix.
104+
so the Play CDN styles match the ones created by Vite.
106105

107106
All in all, this allows you to tinker around with Tailwind without having to compile anything.
108107

docs/digging-deeper/advanced-customization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ You can change the path to this directory by setting the `media_directory` optio
152152

153153
#### Next steps
154154

155-
1. Note that you will likely need to manually update `webpack.mix.js` so Laravel Mix can compile the assets correctly.
155+
1. Note that you will likely need to manually update `vite.config.js` so Vite can compile the assets correctly.
156156
2. You will of course also need to copy over any existing files from the old directory to the new one.
157157

158158
#### Note that this setting affects both source and output directories

docs/digging-deeper/troubleshooting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ You can read more about some of these in the [Core Concepts](core-concepts#paths
7373
| Page not discovered when compiling | The file name may be invalid | Ensure you follow the correct file naming convention. |
7474
| Page compiles slowly | The Torchlight extension may cause the compile times to increase as API calls need to be made. | Try disabling Torchlight |
7575
| Torchlight not working | Missing Composer package, missing API token, extension disabled in the config. | Reinstall Torchlight, add your token in the `.env` file, check config |
76-
| Missing styles and/or assets | You may have accidentally deleted the files, or you have added new Tailwind classes. | Run `npm run dev` |
76+
| Missing styles and/or assets | You may have accidentally deleted the files, or you have added new Tailwind classes. | Run `npm run build` |
7777
| Image not found | You may be using a bad relative path. | Ensure your relative paths are correct. See [managing-assets](managing-assets#referencing-images). |
7878
| Wrong layout used | Hyde determines the layout template to use depending on the directory of the source file | Ensure your source file is in the right directory. |
7979
| Invalid/no permalinks or post URIs | You may be missing or have an invalid site URL | Set the site URL in the `.env` file |

docs/digging-deeper/updating-hyde.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ Here are the paths you may be interested in copying over: (Using Git will help a
116116
├── package.json
117117
├── resources/
118118
├── tailwind.config.js
119-
└── webpack.mix.js
119+
└── vite.config.js
120120
```
121121

122122
Next, recompile your assets, if you are not using the built-in assets.

docs/extensions/ui-kit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The HydePHP UI Kit is a collection of minimalistic and un-opinionated TailwindCSS components for Laravel Blade,
44
indented to be used with HydePHP. Note that these components may require CSS classes not present in the bundled app.css
5-
file and that you may need to recompile the CSS file using the included Laravel Mix configuration.
5+
file and that you may need to recompile the CSS file using the included Tailwind and Vite configuration.
66

77
## Screenshot
88

docs/getting-started/core-concepts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ To take full advantage of the framework, it may first be good to familiarize our
4040
| `_media` | Store static assets to be copied to the build directory |
4141
| `_site` | The build directory where your compiled site will be stored |
4242
| `config` | Configuration files for Hyde and integrations |
43-
| `resources/assets` | Location for Laravel Mix source files (optional) |
43+
| `resources/assets` | Location for CSS/JS Vite source files (optional) |
4444
| `resources/views` | Location for Blade components (optional) |
4545
| `app` | Location for custom PHP classes (optional) |
4646

docs/getting-started/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ on what kind of page it is. You don't have to worry about routing as Hyde takes
6868

6969
### Managing assets
7070

71-
Hyde comes bundled with a precompiled and minified `app.css` file, containing all the Tailwind you need for the default views meaning that you don't even need to use NPM. However, Hyde is already configured to use Laravel Mix to compile your assets if you feel like there's a need to build the assets yourself. See more on the [Managing Assets](managing-assets) page.
71+
Hyde comes bundled with a precompiled and minified `app.css` file, containing all the Tailwind you need for the default views meaning that you don't even need to use NPM. However, Hyde is already configured to use Vite to compile your assets if you feel like there's a need to build the assets yourself. See more on the [Managing Assets](managing-assets) page.
7272

7373
### Deploying your site
7474

monorepo/docs/hydefront.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ This will create commits in both the monorepo and submodule. Now follow the foll
4848

4949
1. Verify that both commits are correct.
5050
2. Build the new `app.css` through the monorepo
51-
- [ ] `npm run prod`
51+
- [ ] `npm run build`
5252
3. Copy the compiled file to the HydeFront repository so it can be served from the CDN.
5353
- [ ] `cp _media/app.css packages/hydefront/dist/app.css`
5454
4. Amend the HydeFront commit with the new `app.css` file.

0 commit comments

Comments
 (0)