code: function ExportRequiredTemplatesMiddleware (context)
  {
    var options = context.options.requiredTemplates;
    var path = require ('path');
  
    /**
     * Paths of the required templates.
     * @type {string[]}
     */
    var paths = [];
  
    //--------------------------------------------------------------------------------------------------------------------
    // PUBLIC API
    //--------------------------------------------------------------------------------------------------------------------
  
    this.analyze = function (filesArray)
    {
      /* jshint unused: vars */
      // Do nothing
    };
  
    this.trace = function (module)
    {
      scan (module.head, module.headPath);
      module.bodies.forEach (function (path, i)
      {
        scan (path, module.bodyPaths[i]);
      });
    };
  
    this.build = function (targetScript)
    {
      /* jshint unused: vars */
  
      // Export file paths.
      context.grunt.config (options.exportToConfigProperty, paths);
    };
  
    //--------------------------------------------------------------------------------------------------------------------
    // PRIVATE
    //--------------------------------------------------------------------------------------------------------------------
  
    /**
     * Extracts file paths from embedded comment references to templates and appends them to `paths`.
     * @param {string} sourceCode
     * @param {string} filePath
     */
    function scan (sourceCode, filePath)
    {
      /* jshint -W083 */
      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));
        });
      }
    }
  
  }
docs: Exports to Grunt's global configuration the paths of all templates 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.