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

Minified Hyperscript code in .hs files #503

Open
lynxionxs opened this issue Dec 12, 2023 · 1 comment
Open

Minified Hyperscript code in .hs files #503

lynxionxs opened this issue Dec 12, 2023 · 1 comment

Comments

@lynxionxs
Copy link

Can Hyperscript code in .hs files be minified ?

@lynxionxs
Copy link
Author

I made a bash script to minify hyperscript code. Not ideal, but i don't have a better solution

#!/bin/bash

filename="$1"
output="hs-min.hs"

line=""
add_space=0

while read -r code_line; do
	if [[ $code_line != \--* ]]; then
		if [ $add_space -eq 1 ]; then
			line="$line "
			add_space=0
		fi
		line="$line$code_line"
		add_space=1
	fi
done <"$filename"

if [ $add_space -eq 1 ]; then
	line="$line "
fi

echo -n "$line" >"$output"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant