Add specific theme build support

This commit is contained in:
Michael Weimann 2022-04-13 11:00:23 +02:00 committed by Igor Scheller
parent 09ec60e42d
commit 7677c09237
2 changed files with 22 additions and 7 deletions

View File

@ -25,10 +25,14 @@ The following instructions explain how to get, build and run the latest Engelsys
```
to install the Engelsystem
* Build the frontend assets
* All
```bash
yarn build
```
* Optionally (for better performance)
* Specific themes only by providing the `THEMES` environment variable, e.g.
```bash
THEMES=0,1 yarn build
```
* Generate translation files
```bash
find resources/lang/ -type f -name '*.po' -exec sh -c 'file="{}"; msgfmt "${file%.*}.po" -o "${file%.*}.mo"' \;
@ -128,9 +132,12 @@ docker-compose exec es_workspace composer i
# Install node packages
docker-compose exec es_workspace yarn install
# Run a front-end build
# Run a full front-end build
docker-compose exec es_workspace yarn build
# Or run a front-end build for specific themes only, e.g.
docker-compose exec -e THEMES=0,1 es_workspace yarn build
# Update the translation files
docker-compose exec es_workspace find /var/www/resources/lang -type f -name '*.po' -exec sh -c 'file="{}"; msgfmt "${file%.*}.po" -o "${file%.*}.mo"' \;
@ -141,8 +148,11 @@ docker-compose exec es_workspace bin/migrate
While developing you may use the watch mode to rebuild the system on changes
```bash
# Run a front-end build
# Run a front-end build and update on change
docker-compose exec es_workspace yarn build:watch
# Or run a front-end build and update on change for specific themes only, e.g.
docker-compose exec -e THEMES=0,1 es_workspace yarn build:watch
```
**Hint for using Xdebug with *PhpStorm***

View File

@ -23,7 +23,12 @@ const plugins = [
}),
];
const themeFileNameRegex = /theme\d+/;
let themeFileNameRegex = /theme\d+/;
if (process.env.THEMES) {
themeFileNameRegex = new RegExp(`theme(${process.env.THEMES.replace(/,/g, '|')})\\.`);
}
const themePath = path.resolve('resources/assets/themes');
const themeEntries = fs
.readdirSync(themePath)