grunt-build-seajs
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "grunt-build-seajs", | ||
"description": "Transport module for seajs.", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"homepage": "https://github.com/dreamstu/grunt-build-seajs", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
}, | ||
"license":"MIT", | ||
"license": "MIT", | ||
"author": { | ||
@@ -22,4 +22,3 @@ "name": "dreamstu", | ||
}, | ||
"devDependencies": { | ||
}, | ||
"devDependencies": {}, | ||
"maintainers": [ | ||
@@ -30,3 +29,6 @@ { | ||
} | ||
] | ||
], | ||
"dependencies": { | ||
"uglify-js": "^2.4.22" | ||
} | ||
} |
var utils = require('../lib/utils'); | ||
var uglify2 = require('../lib/uglify2'); | ||
module.exports = function(grunt) { | ||
@@ -13,3 +14,23 @@ var path = require('path'); | ||
var options = this.options({ | ||
id: '' | ||
id: '', | ||
uglify:{ | ||
min:true,//mini | ||
options:{},//http://lisperator.net/uglifyjs/compress | ||
output:{ | ||
indent_start : 0, // start indentation on every line (only when `beautify`) | ||
indent_level : 4, // indentation level (only when `beautify`) | ||
quote_keys : false, // quote all keys in object literals? | ||
space_colon : true, // add a space after colon signs? | ||
ascii_only : false, // output ASCII-safe? (encodes Unicode characters as ASCII) | ||
inline_script : false, // escape "</script"? | ||
width : 80, // informative maximum line width (for beautified output) | ||
max_line_len : 32000, // maximum line length (for non-beautified output) | ||
ie_proof : true, // output IE-safe code? | ||
beautify : false, // beautify output? | ||
source_map : null, // output a source map | ||
bracketize : false, // use brackets every time? | ||
comments : false, // output comments? | ||
semicolons : true, // use semicolons to separate statements? (otherwise, newlines) | ||
}//http://lisperator.net/uglifyjs/codegen | ||
} | ||
}); | ||
@@ -38,3 +59,3 @@ var wrap_prefix = 'define(function(require, exports, module) {'; | ||
if (options.autowrap && !rDefine.test(content)) { | ||
if (!rDefine.test(content)) { | ||
content = [wrap_prefix, content, wrap_suffix].join('\n'); | ||
@@ -72,2 +93,8 @@ } | ||
var _dest = path.join(file.orig.dest,destUri,file.src[0]); | ||
if(options.uglify){ | ||
contents = uglify2.compressor(file.src[0],contents,options.uglify); | ||
if(options.uglify.min){ | ||
contents = uglify2.min(contents).code; | ||
} | ||
} | ||
grunt.file.write(_dest, contents); | ||
@@ -74,0 +101,0 @@ grunt.log.writeln('File "' + _dest + '" created.'); |
6603
5
164
1
+ Addeduglify-js@^2.4.22
+ Addedalign-text@0.1.4(transitive)
+ Addedcamelcase@1.2.1(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addeduglify-js@2.8.29(transitive)
+ Addeduglify-to-browserify@1.0.2(transitive)
+ Addedwindow-size@0.1.0(transitive)
+ Addedwordwrap@0.0.2(transitive)
+ Addedyargs@3.10.0(transitive)