[packages/jquery-cookie] minify with closure-compier

glen glen at pld-linux.org
Tue May 28 10:07:30 CEST 2013


commit 54271861ab7d253ab3c8f88daa442b3ea25e55ae
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Tue May 28 11:05:28 2013 +0300

    minify with closure-compier
    
    893 -> 858 bytes :D

 jquery-cookie.spec | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/jquery-cookie.spec b/jquery-cookie.spec
index 3133796..e871529 100644
--- a/jquery-cookie.spec
+++ b/jquery-cookie.spec
@@ -10,7 +10,7 @@ Source0:	https://github.com/carhartl/jquery-cookie/archive/v%{version}.tar.gz
 URL:		http://plugins.jquery.com/cookie/
 BuildRequires:	js
 BuildRequires:	rpmbuild(macros) > 1.268
-BuildRequires:	yuicompressor
+BuildRequires:	closure-compiler
 Requires:	jquery >= 1.3
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -27,9 +27,15 @@ cookies.
 %build
 install -d build
 # compress .js
-%{__sed} -e 's,/\*!,/*,' jquery.cookie.js > build/tmp.js
-yuicompressor --charset UTF-8 build/tmp.js -o build/jquery.cookie.js
-js -C -f build/jquery.cookie.js
+for js in jquery.cookie.js; do
+	out=build/${js#*/jquery.}
+%if 0%{!?debug:1}
+	closure-compiler --js $js --charset UTF-8 --js_output_file $out
+	js -C -f $out
+%else
+	cp -p $js $out
+%endif
+done
 
 %install
 rm -rf $RPM_BUILD_ROOT
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/jquery-cookie.git/commitdiff/54271861ab7d253ab3c8f88daa442b3ea25e55ae



More information about the pld-cvs-commit mailing list