node_modules/grunt-angular-builder/tasks/middleware/exportRequiredStylesheets.js
/**
 * Exports to Grunt's global configuration the paths of all stylesheets required by the application,
 * in the order defined by the modules' dependency graph.
 * @constructor
 * @implements {MiddlewareInterface}
 * @param {Context} context The execution context for the middleware stack.
 */
Exports to Grunt's global configuration the paths of all stylesheets required by the application,
in the order defined by the modules' dependency graph.
@constructor
@implements {MiddlewareInterface}
@param {Context} context The execution context for the middleware stack.
Exports to Grunt ' s global configuration the paths of all stylesheets required by the application in the order defined by the modules ' dependency graph . @constructor @implements { MiddlewareInterface } @param { Context } context The execution context for the middleware stack .
function ExportRequiredStylesheetsMiddleware (context)
{
  var options = context.options.requiredStylesheets;
  var path = require ('path');
  var paths = [];
  this.analyze = function (filesArray)
  {
  };
  this.trace = function ( module)
  {
    scan (module.head, module.headPath);
    module.bodies.forEach (function (path, i)
    {
      scan (path, module.bodyPaths[i]);
    });
  };
  this.build = function (targetScript)
  {
    context.grunt.config (options.exportToConfigProperty, paths);
  };
  function scan (sourceCode, filePath)
  {
    var match;
    while ((match = MATCH_DIRECTIVE.exec (sourceCode))) {
      match[1].split (',').forEach (function (s)
      {
        var url = s.match (/(["'])(.*?)\1/)[2];
        paths.push (path.normalize (path.dirname (filePath) + '/' + url));
      });
    }
  }
}
function ExportRequiredStylesheetsMiddleware ( context ) { var options = context . options . requiredStylesheets ; var path = require ( 'path' ) ; var paths = [ ] ; this . analyze = function ( filesArray ) { } ; this . trace = function ( module ) { scan ( module . head , module . headPath ) ; module . bodies . forEach ( function ( path , i ) { scan ( path , module . bodyPaths [ i ] ) ; } ) ; } ; this . build = function ( targetScript ) { context . grunt . config ( options . exportToConfigProperty , paths ) ; } ; function scan ( sourceCode , filePath ) { var match ; while ( ( match = MATCH_DIRECTIVE . exec ( sourceCode ) ) ) { match [ 1 ] . split ( ',' ) . forEach ( function ( s ) { var url = s . match ( / (["'])(.*?)\1 / ) [ 2 ] ; paths . push ( path . normalize ( path . dirname ( filePath ) + '/' + url ) ) ; } ) ; } } }
Exports to Grunt's global configuration the paths of all stylesheets required by the application,
 in the order defined by the modules' dependency graph.
Exports to Grunt ' s global configuration the paths of all stylesheets required by the application in the order defined by the modules ' dependency graph .
/**
   * Paths of the required stylesheets.
   * @type {string[]}
   */ //-------------------------------------------------------------------------------------------------------------------- // PUBLIC API //-------------------------------------------------------------------------------------------------------------------- /* jshint unused: vars */ // Do nothing /*ModuleDef*/ /* jshint unused: vars */ // Export file paths. //-------------------------------------------------------------------------------------------------------------------- // PRIVATE //-------------------------------------------------------------------------------------------------------------------- /**
   * Extracts file paths from embedded comment references to stylesheets and appends them to `paths`.
   * @param {string} sourceCode
   * @param {string} filePath
   */ /* jshint -W083 */