2

RequireJS text plugin (https://github.com/requirejs/text) needs files with .html extension. It seems that the .html requirement cannot be changed.

My html files are located in the web folder of my Symfony project.

With the default configuration it is impossible to serve any static html files with Symfony.

RequireJS is making GET request for the templates but the html content isn't returned.

Is there any known workaround for this ?

Xavier13
  • 771
  • 7
  • 16

1 Answers1

0

In the end I completely separated my backend (Symfony) from my frontend.

Now, I am only rendering the symfony base.html.twig (my main twig template used on all pages) to import my requirejs file which contains all the templates of the website.

Templates are developped in pure html and then transformed into .txt through the use of Gulp. They are all bundled within the .js file of requirejs.

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' }));

});

Xavier13
  • 771
  • 7
  • 16