Skip to content

Commit

Permalink
fix: wrong path for autoload docs
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Sep 27, 2024
1 parent dcf6f2c commit 9e818cf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# --- WireDatabaseBackup {"time":"2024-09-27 14:13:03","user":"","dbName":"db","description":"","tables":[],"excludeTables":["pages_drafts","pages_roles","permissions","roles","roles_permissions","users","users_roles","user","role","permission"],"excludeCreateTables":[],"excludeExportTables":["field_roles","field_permissions","field_email","field_pass","caches","session_login_throttle","page_path_history"]}
# --- WireDatabaseBackup {"time":"2024-09-27 16:05:23","user":"","dbName":"db","description":"","tables":[],"excludeTables":["pages_drafts","pages_roles","permissions","roles","roles_permissions","users","users_roles","user","role","permission"],"excludeCreateTables":[],"excludeExportTables":["field_roles","field_permissions","field_email","field_pass","caches","session_login_throttle","page_path_history"]}

DROP TABLE IF EXISTS `caches`;
CREATE TABLE `caches` (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,19 @@ wire()->addHookAfter("RockFrontend::addLiveReload", function ($event) {

## Executing build scripts on file change

RockFrontend can trigger a build script whenever a file has been changed. It even knows about the page that has been viewed. All you need to do is to add a file `/site/livereload.php` like this one:
RockFrontend can trigger a build script whenever a file has been changed. Just create a file `/site/livereload.php` like this one:

```php
<?php
if ($page->template == 'admin') {
exec('npx tailwindcss -c ./tailwind-admin.config.js -i site/templates/_tailwind-admin.css -o site/templates/bundle/tailwind-admin.min.css --minify');
} else {
exec('npx tailwindcss -i site/templates/_tailwind.css -o site/templates/bundle/tailwind.min.css --minify');
}

if (!defined('PROCESSWIRE')) die();

// early exit if not in debug mode or livereload is not enabled
if (!wire()->config->debug) return;
if (!wire()->config->livereload) return;

// run npm build to compile css from tailwind
exec('npm run build');
```

## Debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<body class='uk-padding uk-text-center'>
<h1>Basic Page</h1>

<p>This is an example of custom layout loading. See <a href="https://www.baumrock.com/en/processwire/modules/site-rockfrontend/docs/autoload-layout/">docs</a> for details!</p>
<p>This is an example of custom layout loading. See <a href="https://www.baumrock.com/en/processwire/modules/rockfrontend/docs/autoload-layout/">docs</a> for details!</p>
</body>
</html>
2 changes: 1 addition & 1 deletion site/templates/basic-page.latte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<body class='uk-padding uk-text-center'>
<h1>Basic Page</h1>

<p>This is an example of custom layout loading. See <a href="https://www.baumrock.com/en/processwire/modules/site-rockfrontend/docs/autoload-layout/">docs</a> for details!</p>
<p>This is an example of custom layout loading. See <a href="https://www.baumrock.com/en/processwire/modules/rockfrontend/docs/autoload-layout/">docs</a> for details!</p>
</body>
</html>

0 comments on commit 9e818cf

Please sign in to comment.