grunt-peaches
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "grunt-peaches", | ||
"description": "The Grunt task for peaches.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "afc163", |
@@ -27,15 +27,15 @@ /* | ||
"alipay": { | ||
"name": "alipay", | ||
"root": "./tmp", | ||
"username": "liuqin.sheng", | ||
"tmp": "./tmp", | ||
"baseURI": "https://i.alipayobjects.com", | ||
"uploadUrl": "https://ecmng.alipay.com/home/uploadFile.json" | ||
"name":"alipay", | ||
"root":"./tmp", | ||
"username":"liuqin.sheng", | ||
"tmp":"./tmp", | ||
"baseURI":"https://i.alipayobjects.com", | ||
"uploadUrl":"https://ecmng.alipay.com/home/uploadFile.json" | ||
}, | ||
"tfsdaily": { | ||
"name": "tfsdaily", | ||
"root": "./images", | ||
"tmp": "./tmp" | ||
"tfsdaily": { | ||
"name": "tfsdaily", | ||
"root": "./images", | ||
"tmp": "./tmp" | ||
} | ||
} | ||
} | ||
}); | ||
@@ -47,41 +47,46 @@ | ||
var destfile, src, srcContent; | ||
var fname, destfile, src; | ||
this.files.forEach(function(fileObj) { | ||
fileObj.src.forEach(function(fpath) { | ||
grunt.util.async.map(this.files,function(fileObj,callback){ | ||
if( fileObj.src.length > 1 ){ | ||
grunt.log.warn('This plugin don\'t support multi src file mapping to one dest file'); | ||
return; | ||
} | ||
var src = fileObj.src[0]; | ||
var destfile = fileObj.dest; | ||
if (src.indexOf('-debug.css') > 0) { | ||
if (fpath.indexOf('-debug.css') > 0) { | ||
return; | ||
} | ||
// get the right filename and filepath | ||
if (fileObj.cwd) { | ||
// not expanded | ||
fname = fpath; | ||
fpath = path.join(fileObj.cwd, fpath); | ||
} else { | ||
fname = path.relative(fileObj.orig.cwd || '', fpath); | ||
} | ||
if (grunt.file.isDir(fpath)) { | ||
grunt.file.mkdir(fpath); | ||
return; | ||
} | ||
} | ||
srcContent = grunt.file.read(src); | ||
src = grunt.file.read(fpath); | ||
destfile = path.join(fileObj.dest, fname); | ||
require('peaches')(srcContent, options, function(err, styleText) { | ||
if (err) { | ||
grunt.log.writeln('Peaches error: ' + err + '.'); | ||
callback(err); | ||
return; | ||
} | ||
require('peaches')(src, options, function(err, styleText) { | ||
if (err) { | ||
grunt.log.writeln('Peaches error: ' + err + '.'); | ||
return; | ||
} | ||
// Write the destination file. | ||
grunt.file.write(destfile, styleText); | ||
// Write the destination file. | ||
grunt.file.write(destfile, styleText); | ||
// Print a success message. | ||
grunt.log.writeln('File "' + destfile + '" created.'); | ||
// Print a success message. | ||
grunt.log.writeln('File "' + destfile + '" created.'); | ||
// Remove temp png files | ||
grunt.file.glob.sync('sprite-*.png').forEach(function(f) { | ||
grunt.file.delete(f); | ||
}); | ||
// Remove temp png files | ||
grunt.file.glob.sync('sprite-*.png').forEach(function(f) { | ||
grunt.file.delete(f); | ||
done(); | ||
}); | ||
callback(null,'done'); | ||
}); | ||
}, function(err,results) { | ||
done(err,results); | ||
}); | ||
@@ -88,0 +93,0 @@ |
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
10023
188