lib/asset-smasher.js
function (cb) {
    this.reset();
    var bundle = this.bundle;
    var self = this;
    async.waterfall([
      function (wfCb) {
        if (self.noclean) {
          wfCb();
        } else {
          // Remove the output directory if it exists
          existsCompat(self.outputTo, function (exists) {
            if (exists) {
              if (self.verbose) {
                console.log('compileAssets: removing output directory: ' + self.outputTo);
              }
              rimraf(self.outputTo, wfCb);
            } else {
              wfCb();
            }
          });
        }
      },
      function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting asset discovery phase.');
        }
        executePhase(self.phases.discovery, bundle, wfCb);
      },
      function (b, wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting compilation phase.');
        }
        try {
          // Get the correct order of asset dependencies
          var orderedAssets = bundle.getProcessingOrder().map(function (assetFilePath) {
            return bundle.getAsset(assetFilePath);
          });
          async.eachSeries(orderedAssets, function (asset, eachCb) {
            setImmediateCompat(function() {
              executePhase(self.phases.compilation, asset, eachCb);
            });
          }, wfCb);
        }
        catch (e) {
          wfCb(e);
        }
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting post-compilation phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.postCompilation, asset, eachCb);
        }, wfCb);
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting output phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.output, asset, eachCb);
        }, wfCb);
      }
    ], cb);
  }
function (cb) {
    this.reset();
    var bundle = this.bundle;
    var self = this;
    async.waterfall([
      function (wfCb) {
        if (self.noclean) {
          wfCb();
        } else {
          // Remove the output directory if it exists
          existsCompat(self.outputTo, function (exists) {
            if (exists) {
              if (self.verbose) {
                console.log('compileAssets: removing output directory: ' + self.outputTo);
              }
              rimraf(self.outputTo, wfCb);
            } else {
              wfCb();
            }
          });
        }
      },
      function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting asset discovery phase.');
        }
        executePhase(self.phases.discovery, bundle, wfCb);
      },
      function (b, wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting compilation phase.');
        }
        try {
          // Get the correct order of asset dependencies
          var orderedAssets = bundle.getProcessingOrder().map(function (assetFilePath) {
            return bundle.getAsset(assetFilePath);
          });
          async.eachSeries(orderedAssets, function (asset, eachCb) {
            setImmediateCompat(function() {
              executePhase(self.phases.compilation, asset, eachCb);
            });
          }, wfCb);
        }
        catch (e) {
          wfCb(e);
        }
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting post-compilation phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.postCompilation, asset, eachCb);
        }, wfCb);
      }, function (wfCb) {
        if (self.verbose) {
          console.log('compileAssets: starting output phase.');
        }
        async.eachLimit(bundle.getAllAssets(), 50, function (asset, eachCb) {
          executePhase(self.phases.output, asset, eachCb);
        }, wfCb);
      }
    ], cb);
  }
function ( cb ) { this . reset ( ) ; var bundle = this . bundle ; var self = this ; async . waterfall ( [ function ( wfCb ) { if ( self . noclean ) { wfCb ( ) ; } else { // Remove the output directory if it exists existsCompat ( self . outputTo , function ( exists ) { if ( exists ) { if ( self . verbose ) { console . log ( 'compileAssets: removing output directory: ' + self . outputTo ) ; } rimraf ( self . outputTo , wfCb ) ; } else { wfCb ( ) ; } } ) ; } } , function ( wfCb ) { if ( self . verbose ) { console . log ( 'compileAssets: starting asset discovery phase.' ) ; } executePhase ( self . phases . discovery , bundle , wfCb ) ; } , function ( b , wfCb ) { if ( self . verbose ) { console . log ( 'compileAssets: starting compilation phase.' ) ; } try { // Get the correct order of asset dependencies var orderedAssets = bundle . getProcessingOrder ( ) . map ( function ( assetFilePath ) { return bundle . getAsset ( assetFilePath ) ; } ) ; async . eachSeries ( orderedAssets , function ( asset , eachCb ) { setImmediateCompat ( function ( ) { executePhase ( self . phases . compilation , asset , eachCb ) ; } ) ; } , wfCb ) ; } catch ( e ) { wfCb ( e ) ; } } , function ( wfCb ) { if ( self . verbose ) { console . log ( 'compileAssets: starting post-compilation phase.' ) ; } async . eachLimit ( bundle . getAllAssets ( ) , 50 , function ( asset , eachCb ) { executePhase ( self . phases . postCompilation , asset , eachCb ) ; } , wfCb ) ; } , function ( wfCb ) { if ( self . verbose ) { console . log ( 'compileAssets: starting output phase.' ) ; } async . eachLimit ( bundle . getAllAssets ( ) , 50 , function ( asset , eachCb ) { executePhase ( self . phases . output , asset , eachCb ) ; } , wfCb ) ; } ] , cb ) ; }
Compile all the assets according to the options
Compile all the assets according to the options