-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
62 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
"use strict"; | ||
var _delete, | ||
__slice = [].slice; | ||
|
||
_delete = function(config, options, next) { | ||
var fileName, fs; | ||
fs = require('fs'); | ||
if (!options.destinationFile) { | ||
var fs = require( "fs" ); | ||
|
||
var _delete = function( config, options, next ) { | ||
|
||
// has no discernable output file | ||
if ( !options.destinationFile ) { | ||
return next(); | ||
} | ||
fileName = options.destinationFile(options.inputFile); | ||
return fs.exists(fileName, function(exists) { | ||
if (!exists) { | ||
|
||
var fileName = options.destinationFile( options.inputFile ); | ||
fs.exists( fileName, function( exists ) { | ||
if ( !exists ) { | ||
return next(); | ||
} | ||
return fs.unlink(fileName, function(err) { | ||
if (err) { | ||
config.log.error("Failed to delete file [[ " + fileName + " ]]"); | ||
|
||
fs.unlink( fileName, function( err ) { | ||
if ( err ) { | ||
config.log.error( "Failed to delete file [[ " + fileName + " ]]" ); | ||
} else { | ||
config.log.success("Deleted file [[ " + fileName + " ]]", options); | ||
config.log.error( "Deleted file [[ " + fileName + " ]]", options ); | ||
} | ||
return next(); | ||
next(); | ||
}); | ||
}); | ||
}; | ||
|
||
exports.registration = function(config, register) { | ||
var e; | ||
e = config.extensions; | ||
return register(['remove', 'cleanFile'], 'delete', _delete, __slice.call(e.javascript).concat(__slice.call(e.css), __slice.call(e.copy), __slice.call(e.misc))); | ||
}; | ||
exports.registration = function( config, register ) { | ||
var e = config.extensions; | ||
register( | ||
["remove", "cleanFile"], | ||
"delete", | ||
_delete, | ||
[].concat.apply(e.javascript, e.css, e.copy, e.misc) | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
"use strict"; | ||
|
||
var fs = require( "fs" ); | ||
|
||
var _delete = function( config, options, next ) { | ||
|
||
// has no discernable output file | ||
if ( !options.destinationFile ) { | ||
return next(); | ||
} | ||
|
||
var fileName = options.destinationFile( options.inputFile ); | ||
fs.exists( fileName, function( exists ) { | ||
if ( !exists ) { | ||
return next(); | ||
} | ||
|
||
fs.unlink( fileName, function( err ) { | ||
if ( err ) { | ||
config.log.error( "Failed to delete file [[ " + fileName + " ]]" ); | ||
} else { | ||
config.log.success( "Deleted file [[ " + fileName + " ]]", options ); | ||
} | ||
next(); | ||
}); | ||
}); | ||
}; | ||
|
||
exports.registration = function( config, register ) { | ||
var e = config.extensions; | ||
register( | ||
["remove", "cleanFile"], | ||
"delete", | ||
_delete, | ||
[].concat.apply(e.javascript, e.css, e.copy, e.misc) | ||
); | ||
}; |