tasks/responsive_images.js
function(srcPath, dstPath, sizeOptions, customDest, origCwd) {
    var baseName = '',
      dirName = '',
      extName = '';

    extName = path.extname(dstPath);
    baseName = path.basename(dstPath, extName); // filename without extension

    if (customDest) {

      sizeOptions.path = srcPath.replace(new RegExp(origCwd), "").replace(new RegExp(path.basename(srcPath)+"$"), "");

      grunt.template.addDelimiters('size', '{%', '%}');

      dirName = grunt.template.process(customDest, {
        delimiters: 'size',
        data: sizeOptions
      });

      checkDirectoryExists(path.join(dirName));
      return path.join(dirName, baseName + extName);
    } else {
      dirName = path.dirname(dstPath);
      checkDirectoryExists(path.join(dirName));
      return path.join(dirName, baseName + sizeOptions.outputName + extName);
    }
  }
function(srcPath, dstPath, sizeOptions, customDest, origCwd) {
    var baseName = '',
      dirName = '',
      extName = '';

    extName = path.extname(dstPath);
    baseName = path.basename(dstPath, extName); // filename without extension

    if (customDest) {

      sizeOptions.path = srcPath.replace(new RegExp(origCwd), "").replace(new RegExp(path.basename(srcPath)+"$"), "");

      grunt.template.addDelimiters('size', '{%', '%}');

      dirName = grunt.template.process(customDest, {
        delimiters: 'size',
        data: sizeOptions
      });

      checkDirectoryExists(path.join(dirName));
      return path.join(dirName, baseName + extName);
    } else {
      dirName = path.dirname(dstPath);
      checkDirectoryExists(path.join(dirName));
      return path.join(dirName, baseName + sizeOptions.outputName + extName);
    }
  }
function ( srcPath , dstPath , sizeOptions , customDest , origCwd ) { var baseName = '' , dirName = '' , extName = '' ; extName = path . extname ( dstPath ) ; baseName = path . basename ( dstPath , extName ) ; // filename without extension if ( customDest ) { sizeOptions . path = srcPath . replace ( new RegExp ( origCwd ) , "" ) . replace ( new RegExp ( path . basename ( srcPath ) + "$" ) , "" ) ; grunt . template . addDelimiters ( 'size' , '{%' , '%}' ) ; dirName = grunt . template . process ( customDest , { delimiters : 'size' , data : sizeOptions } ) ; checkDirectoryExists ( path . join ( dirName ) ) ; return path . join ( dirName , baseName + extName ) ; } else { dirName = path . dirname ( dstPath ) ; checkDirectoryExists ( path . join ( dirName ) ) ; return path . join ( dirName , baseName + sizeOptions . outputName + extName ) ; } }
Gets the destination path

@private
@param   {string}          srcPath   The source path
@param   {string}          filename  Image Filename
@param   {object}          sizeOptions
@param   {string}          customDest
@param   {string}          origCwd
@return                    The complete path and filename
Gets the destination path