Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hot Reloading #7489

Merged
merged 20 commits into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion admin/css/debug-toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
overflow: hidden;
overflow-y: auto;
padding: 0 12px 0 12px;

// Give room for OS X scrollbar
white-space: nowrap;
z-index: 10000;
Expand Down Expand Up @@ -501,3 +501,13 @@
.debug-bar-noverflow {
overflow: hidden;
}

/* ENDLESS ROTATE */
.rotate {
animation: rotate 9s linear infinite;
}
@keyframes rotate {
to {
transform: rotate(360deg);
}
}
7 changes: 7 additions & 0 deletions app/Config/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;

/*
* --------------------------------------------------------------------
Expand Down Expand Up @@ -44,5 +45,11 @@
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
Services::toolbar()->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
Services::routes()->get('__hot-reload', static function () {
(new HotReloader())->run();
});
}
}
});
27 changes: 27 additions & 0 deletions app/Config/Toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,31 @@ class Toolbar extends BaseConfig
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;

/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*/
public array $watchedDirectories = [
'app',
];

/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
}
11 changes: 11 additions & 0 deletions system/Debug/Toolbar/Views/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -796,3 +796,14 @@
.debug-bar-noverflow {
overflow: hidden;
}

/* ENDLESS ROTATE */
.rotate {
animation: rotate 9s linear infinite;
}

@keyframes rotate {
to {
transform: rotate(360deg);
}
}
Loading