[英]Symfony and RequireJS - How to serve static html files?
RequireJS文本插件( https://github.com/requirejs/text )需要擴展名為.html
文件。 似乎.html
要求無法更改。
我的html文件位於我的Symfony項目的web
文件夾中。
使用默認配置, 不可能用Symfony服務任何靜態html文件。
RequireJS正在對模板進行GET請求,但未返回html內容。
有任何已知的解決方法嗎?
最后,我將后端(Symfony)與前端完全分開。
現在,我僅渲染symfony base.html.twig(所有頁面上使用的主要樹枝模板)來導入我的requirejs文件,其中包含網站的所有模板。
模板以純HTML格式開發,然后通過使用Gulp轉換為.txt。 它們都捆綁在requirejs的.js文件中。
gulp.task('devTemplates', ['cleanDevTemplates'], function () {
gulp.src(srcPaths.devTemplates) // The folder which contains the templates
.pipe(minifyHtml())
.pipe(rename({suffix: '', extname: '.txt'}))
.pipe(gulp.dest(destPaths.devTemplates))
.pipe(notify({ message: 'devTemplates task complete' }));
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.