src/embed.js
function embed(sourcePath, relativePaths, name, done) {
  var items = '';
  each(relativePaths, function(relativePath, next) {
    var fullPath = path.join(sourcePath, relativePath);
    fs.readFile(fullPath, 'utf8', function(err, text) {
      if (err) return next(err);
      items += '  $templateCache.put(\'' +
        inline(relativePath) + '\', \'' +
        inline(text.trim()) + '\');\n';
      next();
    });
  }, function(err) {
    if (err) return done(err);
    console.log(
      'angular.module(\'' + inline(name) + '\', []).run([\'$templateCache\', function($templateCache) {\n' +
      items +
      '}]);');
    done();
  });
}
function embed(sourcePath, relativePaths, name, done) {
  var items = '';
  each(relativePaths, function(relativePath, next) {
    var fullPath = path.join(sourcePath, relativePath);
    fs.readFile(fullPath, 'utf8', function(err, text) {
      if (err) return next(err);
      items += '  $templateCache.put(\'' +
        inline(relativePath) + '\', \'' +
        inline(text.trim()) + '\');\n';
      next();
    });
  }, function(err) {
    if (err) return done(err);
    console.log(
      'angular.module(\'' + inline(name) + '\', []).run([\'$templateCache\', function($templateCache) {\n' +
      items +
      '}]);');
    done();
  });
}
function embed ( sourcePath , relativePaths , name , done ) { var items = '' ; each ( relativePaths , function ( relativePath , next ) { var fullPath = path . join ( sourcePath , relativePath ) ; fs . readFile ( fullPath , 'utf8' , function ( err , text ) { if ( err ) return next ( err ) ; items += '  $templateCache.put(\'' + inline ( relativePath ) + '\', \'' + inline ( text . trim ( ) ) + '\');\n' ; next ( ) ; } ) ; } , function ( err ) { if ( err ) return done ( err ) ; console . log ( 'angular.module(\'' + inline ( name ) + '\', []).run([\'$templateCache\', function($templateCache) {\n' + items + '}]);' ) ; done ( ) ; } ) ; }
Embed the relative paths in an angular-specific template wrapper.
@param {string} sourcePath
@param {Array.<string>} relativePaths
@param {string} name
@param {function(Error=)} done
Embed the relative paths in an angular - specific template wrapper .