Menu icon Foundation

My Posts


My Comments

Michael Witrant commented on Andre Ortiz's post over 4 years

The other solutions didn't work for me.

I ended up with this solution inspired by others:

var ext_replace = require('gulp-ext-replace');

gulp.task('compile-haml', function () {
  gulp.src('./client/templates/**/*.haml')
  .pipe(ext_replace('.html'))
  .pipe(router({
    path: 'build/assets/js/routes.js',
    root: 'client'
  }))
  .pipe(haml())
  .pipe(gulp.dest('./build/templates/'));
});

gulp.task('default', ['server'], function () {
  // [...]
  // Watch app templates
  gulp.watch(['./client/templates/**/*.html'], ['copy:templates']);
  gulp.watch(['./client/templates/**/*.haml'], ['compile-haml']);
});

The router is run before haml, so haml doesn't have do handle the front matter.

Posts Followed


Following

    No Content

Followers

My Posts


My Comments

You commented on Andre Ortiz's post over 4 years

The other solutions didn't work for me.

I ended up with this solution inspired by others:

var ext_replace = require('gulp-ext-replace');

gulp.task('compile-haml', function () {
  gulp.src('./client/templates/**/*.haml')
  .pipe(ext_replace('.html'))
  .pipe(router({
    path: 'build/assets/js/routes.js',
    root: 'client'
  }))
  .pipe(haml())
  .pipe(gulp.dest('./build/templates/'));
});

gulp.task('default', ['server'], function () {
  // [...]
  // Watch app templates
  gulp.watch(['./client/templates/**/*.html'], ['copy:templates']);
  gulp.watch(['./client/templates/**/*.haml'], ['compile-haml']);
});

The router is run before haml, so haml doesn't have do handle the front matter.

Posts Followed


Following

  • No Content

Followers

  • No Content