Skip to content

Commit d38da97

Browse files
committed
uglify
1 parent 81cb16a commit d38da97

File tree

18 files changed

+3938
-31
lines changed

18 files changed

+3938
-31
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ pom.xml.asc
66
/target/
77
/checkouts/
88
.nrepl-port
9-
nashorn_code_cache/
9+
nashorn_code_cache/
10+
*.DS_Store

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "resources/html-minifier"]
2+
path = resources/html-minifier
3+
url = [email protected]:kangax/html-minifier.git

README.md

+54-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
A boot task to uglify JS files
22

3-
No man river
3+
“No man ever steps in the same river twice, for it's not the same river and he's not the same man.”
4+
- Heraclitus
45

6+
In case the citation did not give it away, this is a Clojure library.
57

6-
Intended usage :
8+
As an extra optimisation step in the release process to make JavaScript output file(s) smaller, using uglify-js under the hood.
79

8-
As an extra optimisation step in the release process to make the output file smaller.
10+
# Installation
911

12+
[![Clojars Project](https://img.shields.io/clojars/v/nha/boot-uglify.svg)](https://clojars.org/nha/boot-uglify)
13+
14+
Status: alpha
15+
16+
## Usage with boot
1017

1118
Relevant parts to add to the `build.boot` :
1219

@@ -28,7 +35,7 @@ Relevant parts to add to the `build.boot` :
2835
(comp
2936
;;(watch)
3037
(cljs :optimizations :advanced)
31-
(uglify)
38+
(uglify) ;; still provides a gain even after the cljs task
3239
;;(aot)
3340
;;(pom)
3441
;;(uber)
@@ -67,7 +74,47 @@ The defaults :
6774
}
6875
```
6976

70-
Future :
7177

72-
- support source maps (UglifyJS supports it already)
73-
- benchmark output sizes versus the google closure compiler when gzipped on a variety of projects
78+
# As a library
79+
80+
Minifying functions that operate on strings and files are exposed:
81+
82+
# Why ?
83+
84+
I found out that applying UglifyJS2 on my library compiled with :advanced mode of the google closure compiler did yield a size improvement.
85+
86+
87+
88+
# Contributing
89+
90+
Any contribution is very welcome. See the aims section below or issues.
91+
92+
Proposed workflow:
93+
- find/make a project that created js files and add the boot integration as described above (ie. use the library)
94+
- clone this repository
95+
- change the version to version-SNAPSHOT or something like this in both this repository and your project
96+
- in this repository, run : `boot dev`
97+
- in your project, run whatever command produces the JS files (note that show -f can be convenient): `boot production show -f build show -f` or `boot dev uglify-js`
98+
99+
100+
# Aims
101+
102+
Steps (roughly in that order):
103+
104+
- [ ] support source maps (UglifyJS supports it already)
105+
- [ ] make it faster for big files (maybe use uglify-node)
106+
- [ ] benchmark output sizes versus the google closure compiler when gzipped on a variety of projects.
107+
- [ ] minify JS files with different compressors (yui/google-closure/rollup etc.) and see if chaining them yields better results (after gzipping).
108+
- [ ] minify CSS files as well - http://goalsmashers.github.io/css-minification-benchmark/
109+
- [ ] minify HTML directories - see https://github.com/kangax/html-minifier
110+
- [ ] minify JARS with proguard?
111+
- [ ] at any given step, see if some protocol could be implemented
112+
113+
114+
# Thanks
115+
116+
The following libraries were a source of inspiration or code:
117+
118+
- assets-minifier
119+
- boot-cljsjs
120+
- yuanyan/UglifyJS-java

TODO

-4
This file was deleted.

boot.properties

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#https://github.com/boot-clj/boot
2+
#Sat Jun 13 18:06:56 EEST 2015
3+
BOOT_CLOJURE_VERSION=1.8.0
4+
BOOT_VERSION=2.5.5
5+
BOOT_EMIT_TARGET=no

build.boot

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
(set-env!
22
:resource-paths #{"src" "resources"}
3-
:dependencies '[[org.clojure/clojure "1.7.0" :scope "provided"]
4-
[boot/core "2.5.5" :scope "provided"]
5-
[adzerk/bootlaces "0.1.13" :scope "test"]
6-
;; dev only
7-
[boot/core "2.5.5"]
8-
[org.mozilla/rhino "1.7.7"]
9-
[cheshire "5.5.0"]
10-
[org.apache.commons/commons-lang3 "3.4"]
3+
:dependencies '[[org.clojure/clojure "1.8.0" :scope "provided"]
4+
[boot/core "2.5.5" :scope "provided"]
5+
[adzerk/bootlaces "0.1.13" :scope "test"]
6+
[boot/core "2.5.5" :scope "test"]
7+
[org.mozilla/rhino "1.7.7.1" :scope "test"]
8+
[cheshire "5.6.1" :scope "test"]
9+
[org.apache.commons/commons-lang3 "3.4" :scope "test"]
10+
[com.yahoo.platform.yui/yuicompressor "2.4.8" :exclusions [rhino/js] :scope "test"]
11+
[commons-io "2.4" :scope "test"]
12+
[com.google.javascript/closure-compiler "v20160315" :scope "test"]
13+
[org.apache.httpcomponents/httpclient "4.4.1" :scope "test"]
14+
[org.apache.httpcomponents/httpasyncclient "4.1" :scope "test"]
15+
[io.apigee.trireme/trireme-kernel "0.8.9"]
16+
[io.apigee.trireme/trireme-core "0.8.9"]
17+
[io.apigee.trireme/trireme-node10src "0.8.9"]
18+
[io.apigee.trireme/trireme-crypto "0.8.9"]
19+
[io.apigee.trireme/trireme-util "0.8.9"]
20+
[io.apigee.trireme/trireme-shell "0.8.9"]
1121
])
1222

1323
(require '[adzerk.bootlaces :refer :all])
1424

15-
(def +version+ "0.0.1")
25+
(def +version+ "0.0.1-SNAPSHOT")
1626

1727
(bootlaces! +version+)
1828

resources/html-minifier

Submodule html-minifier added at 18c486d
Binary file not shown.

0 commit comments

Comments
 (0)