assets.makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # .assets.makefile:
  2. # curl -fsSL -o $@ https://raw.githubusercontent.com/vladimirok5959/assets/main/assets.makefile
  3. # include .assets.makefile
  4. .PHONY: assets
  5. CHECK_YUI_COMPRESSOR := $(shell command -v yui-compressor 2> /dev/null)
  6. CURRENT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
  7. FILES_CSS := $(shell find ${CURRENT_DIR} -type f -name '*.dev.css')
  8. FILES_JS := $(shell find ${CURRENT_DIR} -type f -name '*.dev.js')
  9. --check-yui-compressor:
  10. @if [ "${CHECK_YUI_COMPRESSOR}" = "" ]; then \
  11. echo "Error: yui-compressor is not installed"; \
  12. exit 1; \
  13. fi
  14. --check-assets-sh-file:
  15. @test -f assets.sh || (curl -fsSL -o assets.sh https://raw.githubusercontent.com/vladimirok5959/assets/main/assets.sh && chmod +x assets.sh)
  16. --assets-css: --check-yui-compressor --check-assets-sh-file
  17. @for file in ${FILES_CSS}; do \
  18. ${CURRENT_DIR}/assets.sh $${file}; \
  19. done
  20. --assets-js: --check-yui-compressor --check-assets-sh-file
  21. @for file in ${FILES_JS}; do \
  22. ${CURRENT_DIR}/assets.sh $${file}; \
  23. done
  24. assets: --assets-css --assets-js
  25. assets-clear-cache:
  26. @find ${CURRENT_DIR}/.cache/ -type f -not -name '.keep' -delete
  27. @rm ${CURRENT_DIR}/assets.sh