2

RequireJS テキスト プラグイン ( https://github.com/requirejs/text.html ) には、拡張子付きのファイルが必要です。.html要件を変更することはできないようです。

私の html ファイルはweb、Symfony プロジェクトのフォルダーにあります。

デフォルトの設定では、Symfony で静的な html ファイルを提供することは不可能です。

RequireJS はテンプレートに対して GET リクエストを行っていますが、html コンテンツは返されません。

これに対する既知の回避策はありますか?

4

1 に答える 1

0

最後に、バックエンド (Symfony) をフロントエンドから完全に分離しました。

現在、symfony の base.html.twig (すべてのページで使用されているメインの 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' }));

});

于 2016-01-09T17:50:51.387 に答える