我正在尝试使用 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, '');
};