Skip to content

Commit 6298a45

Browse files
Merge remote-tracking branch 'origin/dev'
2 parents 260fb7e + e4cf325 commit 6298a45

7 files changed

Lines changed: 49 additions & 5 deletions

File tree

classes/FilenameArray.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ public function remove($file): self
179179
public function save(
180180
string $to,
181181
bool $onlyIfChanged = true,
182+
bool $sourceMap = false,
182183
): self {
183184
$dst = rockdevtools()->toPath($to);
184185

@@ -188,8 +189,8 @@ public function save(
188189
// make sure the folder exists
189190
wire()->files->mkdir(dirname($dst), true);
190191

191-
if ($this instanceof LessArray) $this->saveLESS($dst);
192-
if ($this instanceof ScssArray) $this->saveSCSS($dst);
192+
if ($this instanceof LessArray) $this->saveLESS($dst, sourceMap: $sourceMap);
193+
if ($this instanceof ScssArray) $this->saveSCSS($dst, sourceMap: $sourceMap);
193194
if ($this instanceof CssArray) $this->saveCSS($dst);
194195
if ($this instanceof JsArray) $this->saveJS($dst);
195196

classes/LessArray.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99

1010
class LessArray extends FilenameArray
1111
{
12-
public function saveLESS(string $dst): void
12+
public function saveLESS(string $dst, bool $sourceMap = false): void
1313
{
1414
/** @var Less $less */
1515
$less = wire()->modules->get('Less');
16+
$less->setOption('sourceMap', $sourceMap);
1617
foreach ($this as $file) $less->addFile($file);
1718
$css = $less->getCss();
1819
$css = rockdevtools()->rockcss()->compile($css);

classes/LiveReload.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Nette\Utils\FileInfo;
66
use ProcessWire\HookEvent;
7+
use ProcessWire\Page;
78
use ProcessWire\Wire;
89
use Tracy\Debugger;
910

@@ -29,10 +30,16 @@ public function addBlueScreenPanel(): void
2930
});
3031
}
3132

33+
public function ___addLiveReload(Page $p): bool
34+
{
35+
return true;
36+
}
37+
3238
protected function addLiveReloadMarkup(HookEvent $event): void
3339
{
3440
if (wire()->config->ajax) return;
3541
if (wire()->config->external) return;
42+
if (!$this->addLiveReload($event->object)) return;
3643
$event->return .= $this->scriptTag();
3744
}
3845

classes/ScssArray.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99
class ScssArray extends FilenameArray
1010
{
11-
public function saveSCSS(string $dst, string $style = 'compressed'): void
12-
{
11+
public function saveSCSS(
12+
string $dst,
13+
string $style = 'compressed',
14+
bool $sourceMap = false,
15+
): void {
1316
/** @var Scss $scss */
1417
$scss = wire()->modules->get('Scss');
1518
$compiler = $scss->compiler();
1619
$compiler->setOutputStyle($style);
20+
if ($sourceMap) $compiler->setSourceMap($compiler::SOURCE_MAP_INLINE);
1721

1822
// Gather all unique import paths from the added files
1923
$importPaths = [];

docs/livereload/readme.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ Note: Enable RockDevTools only on development! RockDevTools is designed to never
1414

1515
## Configuration
1616

17+
### Disabling Livereload for Specific Pages
18+
19+
It might be the case that you want to disable LiveReload for specific pages (or the whole backend). This is how you can do it:
20+
21+
```php
22+
// /site/ready.php
23+
wire()->addHookAfter(
24+
'LiveReload::addLiveReload',
25+
function (HookEvent $event) {
26+
$page = $event->arguments(0);
27+
if ($page->template == 'admin') $event->return = false;
28+
}
29+
);
30+
```
31+
1732
### Watched Files
1833

1934
RockDevTools uses Nette's File Finder to find files to watch. The default configuration at the moment of writing this documentation watches the following files:

docs/rockcss/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
RockCSS is a powerful CSS extension that brings fluid typography and responsive scaling to your ProcessWire projects with minimal effort. It introduces two groundbreaking functions - `grow()` and `shrink()` - that make responsive design intuitive and maintainable.
44

5+
> Note: As of 2025-06-11 I recommend to use RockFrontend for this feature! See the docs about the grow feature there!
6+
57
## Why RockCSS is Great
68

79
1. **Simplified Fluid Typography**

docs/sourcemaps/readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# SourceMaps
2+
3+
You might want to generate sourcemaps for easier development. All you need to do is to set the `sourceMap` parameter to true:
4+
5+
```php
6+
$devtools->assets()
7+
->less()
8+
->add('/site/templates/uikit/src/less/uikit.theme.less')
9+
->add('/site/templates/src/*.less')
10+
->save(
11+
'/site/templates/src/.styles.css',
12+
sourceMap: true,
13+
);
14+
```

0 commit comments

Comments
 (0)