grunt-contrib-uglify
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -27,6 +27,7 @@ # Options | ||
## sourceMap | ||
Type: `String` | ||
Type: `String` `Function` | ||
Default: `undefined` | ||
Specify the location to output the source map. | ||
The location to output the sourcemap. If a function is provided, the uglify destination is passed as the argument | ||
and the return value will be used as the sourceMap name. | ||
@@ -37,3 +38,3 @@ ## sourceMapRoot | ||
The location where your source files can be found. | ||
The location where your source files can be found. This option sets the root location in the sourcemap file itself. | ||
@@ -47,6 +48,7 @@ ## sourceMapIn | ||
## sourceMappingURL | ||
Type: `String` | ||
Type: `String` `Function` | ||
Default: `undefined` | ||
The location of your sourcemap. Defaults to the location you use for sourceMap, override if you need finer control | ||
The location of your sourcemap. Defaults to the location you use for sourceMap, override if you need finer control. Provide | ||
a function to dynamically generate the sourceMappingURL based off the destination. | ||
@@ -53,0 +55,0 @@ ## sourceMapPrefix |
@@ -132,2 +132,16 @@ /* | ||
} | ||
}, | ||
multiple_sourcemaps: { | ||
files: { | ||
'tmp/multiple_sourcemaps1.js': ['test/fixtures/src/simple.js'], | ||
'tmp/multiple_sourcemaps2.js': ['test/fixtures/src/comments.js'] | ||
}, | ||
options: { | ||
sourceMap: function(dest) { | ||
return dest.replace(/\.js$/,".map"); | ||
}, | ||
sourceMappingURL: function(dest) { | ||
return dest.replace(/\.js$/,".mapurl"); | ||
} | ||
} | ||
} | ||
@@ -134,0 +148,0 @@ }, |
{ | ||
"name": "grunt-contrib-uglify", | ||
"description": "Minify files with UglifyJS.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/gruntjs/grunt-contrib-uglify", | ||
@@ -31,7 +31,7 @@ "author": { | ||
"dependencies": { | ||
"gzip-js": "~0.3.1", | ||
"uglify-js": "~2.2.1" | ||
"uglify-js": "~2.2.1", | ||
"grunt-lib-contrib": "~0.5.3" | ||
}, | ||
"devDependencies": { | ||
"grunt-contrib-jshint": "~0.1.1", | ||
"grunt-contrib-jshint": "~0.2.0", | ||
"grunt-contrib-nodeunit": "~0.1.2", | ||
@@ -38,0 +38,0 @@ "grunt-contrib-clean": "~0.4.0", |
@@ -16,3 +16,3 @@ # grunt-contrib-uglify [![Build Status](https://secure.travis-ci.org/gruntjs/grunt-contrib-uglify.png?branch=master)](http://travis-ci.org/gruntjs/grunt-contrib-uglify) | ||
One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: | ||
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: | ||
@@ -56,6 +56,7 @@ ```js | ||
#### sourceMap | ||
Type: `String` | ||
Type: `String` `Function` | ||
Default: `undefined` | ||
Specify the location to output the source map. | ||
The location to output the sourcemap. If a function is provided, the uglify destination is passed as the argument | ||
and the return value will be used as the sourceMap name. | ||
@@ -66,3 +67,3 @@ #### sourceMapRoot | ||
The location where your source files can be found. | ||
The location where your source files can be found. This option sets the root location in the sourcemap file itself. | ||
@@ -76,6 +77,7 @@ #### sourceMapIn | ||
#### sourceMappingURL | ||
Type: `String` | ||
Type: `String` `Function` | ||
Default: `undefined` | ||
The location of your sourcemap. Defaults to the location you use for sourceMap, override if you need finer control | ||
The location of your sourcemap. Defaults to the location you use for sourceMap, override if you need finer control. Provide | ||
a function to dynamically generate the sourceMappingURL based off the destination. | ||
@@ -296,2 +298,3 @@ #### sourceMapPrefix | ||
* 2013-01-29 v0.1.2 Added better error reporting Support for dynamic names of multiple sourcemaps | ||
* 2013-02-14 v0.1.1 First official release for Grunt 0.4.0. | ||
@@ -306,2 +309,2 @@ * 2013-01-17 v0.1.1rc6 Updating grunt/gruntplugin dependencies to rc6. Changing in-development grunt/gruntplugin dependency versions from tilde version ranges to specific versions. | ||
*This file was generated on Mon Feb 18 2013 09:00:20.* | ||
*This file was generated on Mon Feb 25 2013 23:41:32.* |
@@ -14,4 +14,4 @@ /* | ||
// Internal lib. | ||
var contrib = require('grunt-lib-contrib').init(grunt); | ||
var uglify = require('./lib/uglify').init(grunt); | ||
var minlib = require('./lib/min').init(grunt); | ||
@@ -31,2 +31,3 @@ grunt.registerMultiTask('uglify', 'Minify files with UglifyJS.', function() { | ||
var banner = grunt.template.process(options.banner); | ||
var mapNameGenerator, mappingURLGenerator; | ||
@@ -45,2 +46,32 @@ // Iterate over all src-dest file pairs. | ||
// function to get the name of the sourceMap | ||
if (typeof options.sourceMap === "function") { | ||
mapNameGenerator = options.sourceMap; | ||
} | ||
// function to get the sourceMappingURL | ||
if (typeof options.sourceMappingURL === "function") { | ||
mappingURLGenerator = options.sourceMappingURL; | ||
} | ||
if (mapNameGenerator) { | ||
try { | ||
options.sourceMap = mapNameGenerator(f.dest); | ||
} catch (e) { | ||
var err = new Error('SourceMapName failed.'); | ||
err.origError = e; | ||
grunt.fail.warn(err); | ||
} | ||
} | ||
if (mappingURLGenerator) { | ||
try { | ||
options.sourceMappingURL = mappingURLGenerator(f.dest); | ||
} catch (e) { | ||
var err = new Error('SourceMapName failed.'); | ||
err.origError = e; | ||
grunt.fail.warn(err); | ||
} | ||
} | ||
// Minify files, warn and fail on error. | ||
@@ -52,2 +83,5 @@ var result; | ||
var err = new Error('Uglification failed.'); | ||
if (e.msg) { | ||
err.message += ', ' + e.msg + '.'; | ||
} | ||
err.origError = e; | ||
@@ -73,3 +107,3 @@ grunt.fail.warn(err); | ||
// ...and report some size information. | ||
minlib.info(result.min, result.max); | ||
contrib.minMaxInfo(result.min, result.max); | ||
}); | ||
@@ -76,0 +110,0 @@ }); |
@@ -40,2 +40,6 @@ 'use strict'; | ||
'sourcemapin.js', | ||
'multiple_sourcemaps1.js', | ||
'multiple_sourcemaps1.map', | ||
'multiple_sourcemaps2.js', | ||
'multiple_sourcemaps2.map', | ||
]; | ||
@@ -42,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
39273
38
497
305
+ Addedgrunt-lib-contrib@~0.5.3
+ Addedgrunt-lib-contrib@0.5.3(transitive)
+ Addedzlib-browserify@0.0.1(transitive)
- Removedgzip-js@~0.3.1
- Removedcrc32@0.2.2(transitive)
- Removeddeflate-js@0.2.3(transitive)
- Removedgzip-js@0.3.2(transitive)