Skip to content

tomseago/uglify-js-middleware

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Uglify JS Middleware

This library is an extension for the Uglify JS library to add middleware for simple use with the Connect library to automatically uglify your JS whenever a source file has been updated.

You can install the library through the Node Package Manager by running npm install uglify-js-middleware.

var uglify = require('uglify-js');
require('uglify-js-middleware');

//app setup...

app.use(uglify.middleware({
  src : __dirname + '/client',
  dest: __dirname + '/public',
});

If you are not already using uglify, the require() of this library will return the middleware function directly.

Configuration

The following options are supported:

  • src: Source directory of JavaScript files.
  • dest: Destination directory to place uglified files. If omitted, this will default to match src and your generated files with be suffixed with .ugly.js rather than just .js.
  • force: Boolean indicating whether to force uglification to occur on every access.
  • mangle: Boolean indicating whether variable names should be mangled.
  • squeeze: Boolean indicating whether the code should be squeezed.
  • uglyext: Boolean indicating whether to use the .ugly.js extension for generated files.

Developed By

License

Copyright 2011 Jake Wharton

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

Connect middleware which will automatically uglify your JS files.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%