gulp-uglify
Advanced tools
Comparing version 0.3.0 to 0.3.1
# gulp-uglify changelog | ||
## 0.3.1 | ||
- Fixed homepage URL in npm metadata | ||
- Removes UglifyJS-inserted sourceMappingURL comment [Fixes #39] | ||
- Don’t pass input source map to UglifyJS if there are no mappings | ||
- Added installation instructions | ||
## 0.3.0 | ||
@@ -4,0 +11,0 @@ |
@@ -5,3 +5,4 @@ 'use strict'; | ||
merge = require('deepmerge'), | ||
uglifyError = require('./lib/error.js'); | ||
uglifyError = require('./lib/error.js'), | ||
reSourceMapComment = /\n\/\/# sourceMappingURL=.+?$/; | ||
@@ -35,3 +36,5 @@ module.exports = function(opt) { | ||
options.outSourceMap = file.relative; | ||
options.inSourceMap = file.sourceMap; | ||
if (file.sourceMap.mappings !== '') { | ||
options.inSourceMap = file.sourceMap; | ||
} | ||
originalSourceMap = file.sourceMap; | ||
@@ -51,3 +54,3 @@ } | ||
mangled = uglify.minify(String(file.contents), options); | ||
file.contents = new Buffer(mangled.code); | ||
file.contents = new Buffer(mangled.code.replace(reSourceMapComment, '')); | ||
} catch (e) { | ||
@@ -54,0 +57,0 @@ return callback(uglifyError(e.message, { |
{ | ||
"name": "gulp-uglify", | ||
"description": "Minify files with UglifyJS.", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Terin Stock <terinjokes@gmail.com>", | ||
@@ -14,3 +14,7 @@ "bugs": "https://github.com/terinjokes/gulp-uglify/issues", | ||
"devDependencies": { | ||
"argg": "0.0.1", | ||
"codeclimate-test-reporter": "0.0.3", | ||
"inline-source-map": "^0.3.0", | ||
"istanbul": "^0.2.8", | ||
"rimraf": "^2.2.8", | ||
"tape": "^2.12.3", | ||
@@ -22,3 +26,3 @@ "vinyl": "~0.2.3" | ||
}, | ||
"homepage": "http://terinjokes.github.io/gulp-uglify/", | ||
"homepage": "https://github.com/terinjokes/gulp-uglify/", | ||
"keywords": [ | ||
@@ -31,4 +35,8 @@ "gulpplugin" | ||
"scripts": { | ||
"test": "tape test/*.js" | ||
"codeclimate": "cat ./coverage/lcov.info|codeclimate", | ||
"coverage": "istanbul cover node_modules/argg test/*.js --report lcovonly", | ||
"rm": "rimraf ./coverage", | ||
"test": "npm run coverage && npm run rm", | ||
"test-report": "npm run coverage && npm run codeclimate && npm run rm" | ||
} | ||
} |
@@ -1,5 +0,11 @@ | ||
# gulp-uglify [![Build Status](http://img.shields.io/travis/terinjokes/gulp-uglify.svg)](https://travis-ci.org/terinjokes/gulp-uglify) [![](http://img.shields.io/npm/dm/gulp-uglify.svg)](https://www.npmjs.org/package/gulp-uglify) [![](http://img.shields.io/npm/v/gulp-uglify.svg)](https://www.npmjs.org/package/gulp-uglify) [![](http://img.shields.io/codeclimate/github/terinjokes/gulp-uglify.svg)](https://codeclimate.com/github/terinjokes/gulp-uglify) | ||
# gulp-uglify [![Build Status](http://img.shields.io/travis/terinjokes/gulp-uglify.svg?style=flat)](https://travis-ci.org/terinjokes/gulp-uglify) [![](http://img.shields.io/npm/dm/gulp-uglify.svg?style=flat)](https://www.npmjs.org/package/gulp-uglify) [![](http://img.shields.io/npm/v/gulp-uglify.svg?style=flat)](https://www.npmjs.org/package/gulp-uglify) [![](http://img.shields.io/codeclimate/github/terinjokes/gulp-uglify.svg?style=flat)](https://codeclimate.com/github/terinjokes/gulp-uglify) [![](http://img.shields.io/codeclimate/coverage/github/terinjokes/gulp-uglify.svg?style=flat)](https://codeclimate.com/github/terinjokes/gulp-uglify) | ||
> Minify JavaScript with UglifyJS2. | ||
## Installation | ||
Install package with NPM and add it to your development dependencies: | ||
`npm install --save-dev gulp-uglify` | ||
## Usage | ||
@@ -6,0 +12,0 @@ |
@@ -7,6 +7,7 @@ 'use strict'; | ||
inlineSourceMap = require('inline-source-map'); | ||
var testContentsInput = '"use strict"; (function(console, first, second) { console.log(first + second) }(5, 10))'; | ||
var testContentsExpected = uglifyjs.minify(testContentsInput, {fromString: true}).code; | ||
var testSourceMap = inlineSourceMap().addGeneratedMappings('test1.js', testContentsInput, {line:0, column:0}).addSourceContent('test1.js', testContentsInput).toJSON(); | ||
var emptySourceMap = inlineSourceMap().addSourceContent('test2.js', testContentsInput).toJSON(); | ||
@@ -21,3 +22,11 @@ var testFile1 = new Vinyl({ | ||
test('should minify files', function(t) { | ||
var testFile2 = new Vinyl({ | ||
cwd: "/home/terin/broken-promises/", | ||
base: "/home/terin/broken-promises/test", | ||
path: "/home/terin/broken-promises/test/test2.js", | ||
contents: new Buffer(testContentsInput) | ||
}); | ||
testFile2.sourceMap = emptySourceMap; | ||
function testWithFile(t, file) { | ||
t.plan(13); | ||
@@ -46,3 +55,11 @@ | ||
stream.write(testFile1); | ||
stream.write(file); | ||
} | ||
test('should minify files', function(t) { | ||
testWithFile(t, testFile1); | ||
}); | ||
test('should generate a valid source map with an empty input source map', function(t) { | ||
testWithFile(t, testFile2); | ||
}); |
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
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
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13792
233
1
64
7