summaryrefslogtreecommitdiffhomepage
path: root/luci.mk
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-12-12 09:34:44 +0100
committerJo-Philipp Wich <jo@mein.io>2018-12-12 09:47:37 +0100
commit0de1dcbf4a04940abf0e67d0f5f9e40523167cb1 (patch)
treeb334d56777dbcf7c3df889d620eba52559011d7f /luci.mk
parente90431b870edc2731435f018e607a365a9910cae (diff)
build: add build option to minify *.css files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'luci.mk')
-rw-r--r--luci.mk16
1 files changed, 14 insertions, 2 deletions
diff --git a/luci.mk b/luci.mk
index aa2e195e2..2dab144ca 100644
--- a/luci.mk
+++ b/luci.mk
@@ -83,8 +83,8 @@ PKG_GITBRANCH?=$(if $(DUMP),x,$(strip $(shell \
PKG_RELEASE?=1
PKG_INSTALL:=$(if $(realpath src/Makefile),1)
-PKG_BUILD_DEPENDS += lua/host luci-base/host $(LUCI_BUILD_DEPENDS)
-PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN
+PKG_BUILD_DEPENDS += lua/host luci-base/host LUCI_CSSTIDY:csstidy/host $(LUCI_BUILD_DEPENDS)
+PKG_CONFIG_DEPENDS += CONFIG_LUCI_SRCDIET CONFIG_LUCI_JSMIN CONFIG_LUCI_CSSTIDY
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -117,6 +117,10 @@ ifeq ($(PKG_NAME),luci-base)
bool "Minify JavaScript sources"
default y
+ config LUCI_CSSTIDY
+ bool "Minify CSS files"
+ default y
+
menu "Translations"$(foreach lang,$(LUCI_LANGUAGES),
config LUCI_LANG_$(lang)
@@ -169,6 +173,13 @@ define JsMin
done
endef
+define CssTidy
+ $(FIND) $(1) -type f -name '*.css' | while read src; do \
+ if csstidy "$$$$src" --template=highest --remove_last_semicolon=true "$$$$src.o"; \
+ then mv "$$$$src.o" "$$$$src"; fi; \
+ done
+endef
+
define SubstituteVersion
$(FIND) $(1) -type f -name '*.htm' | while read src; do \
$(SED) 's/<%# *\([^ ]*\)PKG_VERSION *%>/\1$(PKG_VERSION)/g' \
@@ -189,6 +200,7 @@ define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)$(HTDOCS); \
cp -pR $(PKG_BUILD_DIR)/htdocs/* $(1)$(HTDOCS)/; \
$(if $(CONFIG_LUCI_JSMIN),$(call JsMin,$(1)$(HTDOCS)/),true); \
+ $(if $(CONFIG_LUCI_CSSTIDY),$(call CssTidy,$(1)$(HTDOCS)/),true); \
else true; fi
if [ -d $(PKG_BUILD_DIR)/root ]; then \
$(INSTALL_DIR) $(1)/; \