我正在尝试使用ng-html2js来填充我的$templateCache来运行一些单元测试。
问题是,我的模板位于不同的项目中,并且我使用它们的相对路径:
preprocessors: {
'..//project2//Content//Templates/**/*.html': ['ng-html2js']
},它将缓存条目存储为:
"C:\Users\user\Documents\GitHub\solutiondir\project2\Content\Templates\“
问题:
有没有什么stripPrefix值可以用来删除整个:
C:\Users\user\Documents\GitHub\solutiondir\project2\,,不管用户名是什么,它都可以工作吗?
基本上,它可能是找出正确的正则表达式,因为预处理器的代码是这样的:
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, '');
};发布于 2015-04-15 23:28:58
好吧,我在这里想出来了:
ngHtml2JsPreprocessor: {
// If your build process changes the path to your TEMPLATES,
// use stripPrefix and prependPrefix to adjust it.
stripPrefix: "(.*)project2",
},https://stackoverflow.com/questions/29653694
复制相似问题