Skip to content

Commit c8a4e3a

Browse files
committed
Remove UglifyJS dependency for the compilation script. Closes blueimp#45.
1 parent 14d8b68 commit c8a4e3a

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -352,20 +352,18 @@ Use **include(str, obj)** to include content from a different template:
352352
## Compiled templates
353353
The JavaScript Templates project comes with a compilation script, that allows
354354
you to compile your templates into JavaScript code and combine them with a
355-
minimal Templates runtime into one minified JavaScript file.
355+
minimal Templates runtime into one combined JavaScript file.
356356

357-
The compilation script is built for [node.js](http://nodejs.org/) and also
358-
requires [UglifyJS](https://github.com/mishoo/UglifyJS).
359-
To use it, first install both the JavaScript Templates project and UglifyJS via
357+
The compilation script is built for [node.js](http://nodejs.org/).
358+
To use it, first install the JavaScript Templates project via
360359
[npm](https://www.npmjs.org/):
361360

362361
```sh
363-
npm install uglify-js blueimp-tmpl
362+
npm install blueimp-tmpl
364363
```
365364

366-
This will put the executables **uglifyjs** and **tmpl.js** into the folder
367-
**node_modules/.bin**. It will also make them available on your PATH if you
368-
install the packages globally
365+
This will put the executable **tmpl.js** into the folder **node_modules/.bin**.
366+
It will also make it available on your PATH if you install the package globally
369367
(by adding the **-g** flag to the install command).
370368

371369
The **tmpl.js** executable accepts the paths to one or multiple template files
@@ -374,7 +372,7 @@ console output. The following command line shows you how to store the generated
374372
code in a new JavaScript file that can be included in your project:
375373

376374
```sh
377-
tmpl.js templates/upload.html templates/download.html > tmpl.min.js
375+
tmpl.js index.html > tmpl.js
378376
```
379377

380378
The files given as command line arguments to **tmpl.js** can either be pure

js/compile.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
var path = require('path')
1818
var tmpl = require(path.join(__dirname, 'tmpl.js'))
1919
var fs = require('fs')
20-
var uglifyJS = require('uglify-js')
2120
// Retrieve the content of the minimal runtime:
2221
var runtime = fs.readFileSync(path.join(__dirname, 'runtime.js'), 'utf8')
2322
// A regular expression to parse templates from script tags in a HTML page:
@@ -78,6 +77,6 @@
7877
}
7978
// Combine the generated functions as cache of the minimal runtime:
8079
code = runtime.replace('{}', '{' + list.join(',') + '}')
81-
// Generate the minified code and print it to the console output:
82-
console.log(uglifyJS.minify(code, {fromString: true}).code)
80+
// Print the resulting code to the console output:
81+
console.log(code)
8382
}())

0 commit comments

Comments
 (0)