Skip to content

Commit

Permalink
Support for mounts points in static configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jan 30, 2025
1 parent 9e2a600 commit e10310a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/4-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ static:
target: '' # target directory
exclude: ['sass', 'scss', '*.scss', 'package*.json', 'node_modules'] # list of excluded files (accepts globs, strings and regexes)
load: false # enables `site.static` collection (`false` by default)
mounts: [] # allows to copy specific files or directories to specific destination in files directory
```
:::important
Expand All @@ -848,6 +849,16 @@ exclude: ['sass', 'scss', '*.scss', 'package*.json', '#node_modules/(?!bootstrap

:::

:::tip
You can copy some files to a specific destination.

```yaml
mounts:
'static/node_modules/bootstrap-icons/font/fonts': 'fonts'
```

:::

_Example:_

```yaml
Expand Down
7 changes: 7 additions & 0 deletions src/Step/StaticFiles/Copy.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ public function process(): void
}
}

// copying mounts
if ($this->config->get('static.mounts')) {
foreach($this->config->get('static.mounts') as $source => $destination) {
$this->copy($source, $destination);
}
}

// copying content of 'static/' dir if exists
$this->copy($this->config->getStaticPath(), $target, $exclude);

Expand Down

0 comments on commit e10310a

Please sign in to comment.