Skip to content

Commit

Permalink
Fix Issue 15449 - CSS and JS files should be minified
Browse files Browse the repository at this point in the history
  • Loading branch information
wilzbach committed Mar 30, 2018
1 parent b413e09 commit 2c8240d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#
# DIFFABLE=1 Removes inclusion of all dynamic content and timestamps
# RELEASE=1 Release build (needs to be set for the `release` target)
# CSS_MINIFY=1 Minify the CSS via an online service
# MINIFY=1 Minify the CSS and JS (requires)
# DOC_OUTPUT_DIR Folder to build the documentation (default: `web`)
#
# Other targets
Expand Down Expand Up @@ -230,6 +230,9 @@ else
CHANGELOG_VERSION_STABLE := "v${LATEST}..upstream/stable"
endif

# Set to 1 in the command line to minify css files
MINIFY=0

################################################################################
# Ddoc build variables
################################################################################
Expand Down Expand Up @@ -277,9 +280,6 @@ DDOC_BIN_DMD:=$(DDOC_BIN) --compiler=$(DMD)
# Resources
################################################################################

# Set to 1 in the command line to minify css files
CSS_MINIFY=

ORGS_USING_D=$(wildcard images/orgs-using-d/*)
IMAGES=favicon.ico $(ORGS_USING_D) $(addprefix images/, \
d002.ico \
Expand Down Expand Up @@ -494,15 +494,23 @@ $W/%.php : %.php.dd $(DDOC) $(DMD)

$W/css/% : css/%
@mkdir -p $(dir $@)
ifeq (1,$(CSS_MINIFY))
curl -X POST -fsS --data-urlencode 'input@$<' http://cssminifier.com/raw >$@
ifeq (1,$(MINIFY))
yui-compressor --type css -o $@ $<
else
cp $< $@
endif

$W/%.css : %.css.dd $(DMD)
$(DMD) -c -o- -Df$@ $<

$W/js/%.js : js/%.js
ifeq (1,$(MINIFY))
yui-compressor --type js -o $@ $<
else
cp $< $@
endif


$W/% : %
@mkdir -p $(dir $@)
cp $< $@
Expand Down

0 comments on commit 2c8240d

Please sign in to comment.