分享 好一段变态的 makefile,js 压缩用的

i5ting · 2014年12月04日 · 2135 次阅读

好一段变态的 makefile,js 压缩用的

SHELL := /bin/bash

QS=compilation_level=SIMPLE_OPTIMIZATIONS&output_format=text
URL=http://closure-compiler.appspot.com/compile
CODE=js_code@lib/fastclick.js

CHECK=\033[32m✔\033[39m

build/fastclick.min.js: lib/fastclick.js
    @mkdir -p build
    @echo -n "Building build/fastclick.min.js...                  "
    @curl --silent --show-error --data-urlencode "${CODE}" --data "${QS}&output_info=compiled_code" ${URL} -o build/fastclick.min.js
    @echo -e "${CHECK} Done"
    @echo -n "Getting compression stats...                        "
    @echo -e "${CHECK} Done\n\n" "`curl --silent --show-error --data-urlencode "${CODE}" --data "${QS}&output_info=statistics" ${URL}`"
    @echo ${STATS}

test:
    jshint -v lib/*.js

clean:
    rm -rf build

.PHONY: clean test

要点

  • 使用 closure
  • 天朝还得翻墙
  • 其他 makefile 写的很好

不过,真心没有 gulp 好用

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请 注册新账号