node_modules/grunt-angular-builder/tasks/middleware/buildForeignScripts.js
/**
 * Builds non-angular-module scripts.
 *
 * On release builds, this extension saves all non-module script files required by the application into a
 * single output file, in the correct loading order.
 *
 * On debug builds, it appends SCRIPT tags to the head of the html document, which will load the original
 * source scripts in the correct order.
 *
 * @constructor
 * @implements {MiddlewareInterface}
 * @param {Context} context The execution context for the middleware stack.
 */
Builds non-angular-module scripts.
On release builds, this extension saves all non-module script files required by the application into a
single output file, in the correct loading order.

On debug builds, it appends SCRIPT tags to the head of the html document, which will load the original
source scripts in the correct order.

@constructor
@implements {MiddlewareInterface}
@param {Context} context The execution context for the middleware stack.
Builds non - angular - module scripts . On release builds this extension saves all non - module script files required by the application into a single output file in the correct loading order . On debug builds it appends SCRIPT tags to the head of the html document which will load the original source scripts in the correct order . @constructor @implements { MiddlewareInterface } @param { Context } context The execution context for the middleware stack .
function BuildForeignScriptsMiddleware (context)
{
  this.analyze = function (filesArray)
  {
  };
  this.trace = function (module)
  {
  };
  this.build = function (targetScript)
  {
    if (context.standaloneScripts.length) {
      if (context.options.debugBuild && context.options.debugBuild.enabled) {
        var rep = context.options.debugBuild.rebaseDebugUrls;
        context.prependOutput += (context.standaloneScripts.map (function (e)
        {
          var path = e.path.replace (MATCH_PATH_SEP, '/'); 
          if (rep)
            for (var i = 0, m = rep.length; i < m; ++i)
              path = path.replace (rep[i].match, rep[i].replaceWith);
          if (path) 
            return util.sprintf ('<script src=\"%\"></script>', path);
          return '';
        })
          .filter (function (x) {return x;}) 
          .join ('\\\n'));
      }
      else if (context.options.releaseBuild && context.options.releaseBuild.enabled) {
        var output = context.standaloneScripts.map (function (e) { return e.content; }).join (NL);
        util.writeFile (targetScript, output);
      }
    }
  };
}
function BuildForeignScriptsMiddleware ( context ) { this . analyze = function ( filesArray ) { } ; this . trace = function ( module ) { } ; this . build = function ( targetScript ) { if ( context . standaloneScripts . length ) { if ( context . options . debugBuild && context . options . debugBuild . enabled ) { var rep = context . options . debugBuild . rebaseDebugUrls ; context . prependOutput += ( context . standaloneScripts . map ( function ( e ) { var path = e . path . replace ( MATCH_PATH_SEP , '/' ) ; if ( rep ) for ( var i = 0 , m = rep . length ; i < m ; ++ i ) path = path . replace ( rep [ i ] . match , rep [ i ] . replaceWith ) ; if ( path ) return util . sprintf ( '<script src=\"%\"></script>' , path ) ; return '' ; } ) . filter ( function ( x ) { return x ; } ) . join ( '\\\n' ) ) ; } else if ( context . options . releaseBuild && context . options . releaseBuild . enabled ) { var output = context . standaloneScripts . map ( function ( e ) { return e . content ; } ) . join ( NL ) ; util . writeFile ( targetScript , output ) ; } } } ; }
Builds non-angular-module scripts.
Builds non - angular - module scripts .
//-------------------------------------------------------------------------------------------------------------------- // PUBLIC API //-------------------------------------------------------------------------------------------------------------------- /* jshint unused: vars */ // Do nothing /* jshint unused: vars */ // Do nothing // Output the standalone scripts (if any). // Debug Build // Convert file paths to URLs. // Ignore empty path; it means that this middleware should not output a script tag. // Remove empty paths. // Release Build /** @type {string[]} */ //Note: the ensuing release/debug build step will append to the file created here.