From 98dd9360e398ea939422317419abcf44c269be65 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 28 Feb 2012 20:34:21 -0500 Subject: (1) Use phony %.min.js files (2) copyright headers in d3.*.js (3) Makefile! ---- Due to our support of free software, we have two (uncommon) requirements for .min.js files: 1. They preserve the header comments; for license-identification 2. They can be created with free software; a free minifier, SaaS does not count. The only viable way to do this is to use django's compress.py, which requires the Google Closure Compiler, (or use the closure-compiler directly), which is not (yet) packaged for Parabola. So, for now just copy the *.js to *.min.js in order to avoid having to change URLs to temporarily point to the non-minified versions until we can properly minify them. ---- Add copyright headers to d3.js files, which by default ship without the copyright included in the file, despite being free software. ---- Create a Makefile that automatically does this. It fetches the d3 and jquery .js files, adds the copyright headers to the d3.*.js files, and then copies .js files to .min.js files. --- media/Makefile | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 media/Makefile (limited to 'media/Makefile') diff --git a/media/Makefile b/media/Makefile new file mode 100644 index 00000000..a250a414 --- /dev/null +++ b/media/Makefile @@ -0,0 +1,31 @@ +d3version=2.4.3 +jqueryversion=1.4.4 + +all: d3.min.js d3.layout.min.js jquery-$(jqueryversion).min.js jquery.tablesorter.min.js + +%.min.js: %.js + $(closurecompiler) '$<' + +jquery-$(jqueryversion).js: + wget http://code.jquery.com/$@ + +d3.%: .d3/d3-$(d3version) Makefile + echo '/* $@ - Data Driven Documents' > $@ + echo ' * Version: $(d3version)' >> $@ + echo ' * Homepage: http://mbostock.github.com/d3/' >> $@ + echo ' * Copyright: 2010, Michael Bostock' >> $@ + echo ' * Licence: 3-Clause BSD' >> $@ + echo ' *' >> $@ + sed 's/./ * &/' $> $@ + echo ' */' >> $@ + cat $> $@ +.d3/d3-%.tar.gz: Makefile + mkdir -p $(@D) + wget https://github.com/mbostock/d3/tarball/v$* -O $@ +.d3/d3-%: .d3/d3-%.tar.gz Makefile + mkdir -p $<.d + cd $<.d && tar xzf ../d3-$*.tar.gz + cp -r $<.d/*/ $@ + +.SECONDARY: +closurecompiler=compiler() { cp "$$1" "$${1%.js}.min.js"; }; compiler -- cgit v1.2.3-54-g00ecf