Şablonların farklı klasörlerde bulunduğu bir dosya yapısına sahibim, ancak derleme görevi bunları tek bir klasöre yerleştiriyor. Tüm farklı önekleri dosyalardan ayırmak ve doğru yapı önekini eklemek istiyorum.html2js önişlemci çoklu önekleri sıyırma
Bu kadar tüm önek kaldırmak için bir yol var mı bu
ngHtml2JsPreprocessor: {
stripPrefix: "src/components/**",
prependPrefix: "/assets/components",
moduleName: "templates"
},
gibi bir şey ben önişlemcisinden aynı işlevselliği arıyorum tüm şablonları
preprocessors: {
'src/components/**/*_template.html': ['ng-html2js']
}
yüklemeye çalışır template.html? aşağıdaki gibi
benim klasör yapısı şöyledir: önceden
build
assets
components
email_template.html
phone_template.html
Teşekkür şöyle
src
components
email
directive.js
service.js
email_template.html
phone
directive.js
service.js
phone_template.html
inşa klasördür. muhtemelen bu
ngHtml2JsPreprocessor: {
// define a custom transform function
// - cacheId returned is used to load template
// module(cacheId) will return template at filepath
cacheIdFromPath: function(filepath) {
// example strips 'public/' from anywhere in the path
// module(app/templates/template.html) => app/public/templates/template.html
var cacheId = filepath.strip('public/', '');
**do whatever you need to construct the path**
return cacheId;
},
}
aradığınız
Neden? 'ngHtml2Js', tüm şablonları dizgiler olarak' $ templateCache''e yerleştirir. Tek tek şablon dosyaları yazmamalı – Phil
@Phil ngHtml2Js, src dizinindeki şablonları önbelleğe alır ancak karma testler yapı dosyalarını yüklemeyi denediğinde başarısız olur. ngHtml2Js, src önekini çıkarır ve yapı önekini ekler, böylece karma sınaması GET /assets/components/email_template.html'yi denediğinde, şablona sunulur. – JordanC