shiori/scripts/styles.sh
cbe 7765e5bf42
chore: frontend formatting (#764)
* Install `prettier`

Ignore everything in the first step as I want to see the size of changes
that are going to happen first

* Configure prettier

- use tabs as the whole project prefers tabs
- ignore a bunch of files that shouldn't be formatted

* Check & format with prettier when compiling less

* Update docs to use bun

Since bun handles the dependencies used for the CSS compilation this
should be the preferred method from now on.

* Check actual result of prettier

* Use LF line endings

All files where formatted in LF and since it's most common in git repos
we should probably keep it this way

* Limit prettier to `internal/view/`

See pull request review
https://github.com/go-shiori/shiori/pull/764#pullrequestreview-1702935417

* Format code with prettier
2023-11-05 11:02:31 +01:00

25 lines
860 B
Bash
Executable file

#!/bin/bash
INPUT_STYLECSS=internal/view/assets/less/style.less
OUTPUT_STYLECSS=internal/view/assets/css/style.css
INPUT_ARCHIVECSS=internal/view/assets/less/archive.less
OUTPUT_ARCHIVECSS=internal/view/assets/css/archive.css
# Use bun is installled
if [ -x "$(command -v bun)" ]; then
bun install
bun x prettier internal/view/ --write
bun x lessc $INPUT_STYLECSS $OUTPUT_STYLECSS
bun x lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS
bun x clean-css-cli $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
exit 0
fi
# Default to lessc and cleancss
lessc $INPUT_STYLECSS $OUTPUT_STYLECSS
lessc $INPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS
cleancss $CLEANCSS_OPTS -o $OUTPUT_STYLECSS $OUTPUT_STYLECSS
cleancss $CLEANCSS_OPTS -o $OUTPUT_ARCHIVECSS $OUTPUT_ARCHIVECSS