mirror of
				https://git.ari.lt/ari.lt/ari.lt.git
				synced 2025-10-31 01:21:48 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
	
		
			548 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
	
		
			548 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
| #!/usr/bin/env sh
 | |
| 
 | |
| set -e
 | |
| 
 | |
| main() {
 | |
|     if [ "$CI" ]; then
 | |
|         echo 'Minifying all HTML'
 | |
| 
 | |
|         find . -not -ipath "./node_modules/*" -type d -exec sh -c 'find {} -maxdepth 0 -name ".minexclude"' \; -prune -o -type f -name "*.html" \
 | |
|             -exec html-minifier --collapse-whitespace -o {}.min {} \; \
 | |
|             -exec rm {} \; \
 | |
|             -exec mv {}.min {} \; \
 | |
|             -exec sh -c "printf '\n\n%s\n' '<!-- source code @ /git -->' >>\"\$1\"" -- {} \;
 | |
|     else
 | |
|         echo 'Not minifying HTML in non-CI mode'
 | |
|     fi
 | |
| }
 | |
| 
 | |
| main "$@"
 |