2

I'm trying to use ng-html2js in order to fill my $templateCache to run some unit tests.

Problem is, that my templates are located on a different project, and I use a relative path to them:

 preprocessors: {
        '..//project2//Content//Templates/**/*.html': ['ng-html2js']
    },

It turns that the cache entries are stored as:

"C:\Users\user\Documents\GitHub\solutiondir\project2\Content\Templates\"

Question:

Is there any stripPrefix value that I could use to remove the entire:

C:\Users\user\Documents\GitHub\solutiondir\project2\, and that would work regardless of the user name?

It might be, basically, figuring out the right Regex it seems, as the code of the preprocessor is like so:

    var log = logger.create('preprocessor.html2js');
  var moduleName = config.moduleName;
  var stripPrefix = new RegExp('^' + (config.stripPrefix || ''));
  var prependPrefix = config.prependPrefix || '';
  var stripSufix = new RegExp((config.stripSufix || '') + '$');
  var cacheIdFromPath = config && config.cacheIdFromPath || function(filepath) {
    return prependPrefix + filepath.replace(stripPrefix, '').replace(stripSufix, '');
  };
Luiz Rolim
  • 277
  • 2
  • 12

1 Answers1

5

well, figured out here:

 ngHtml2JsPreprocessor: {
        // If your build process changes the path to your TEMPLATES,
        // use stripPrefix and prependPrefix to adjust it.
        stripPrefix: "(.*)project2",


    },
Luiz Rolim
  • 277
  • 2
  • 12