miickel / gulp-angular-templatecache

Concatenates and registers AngularJS templates in the $templateCache.
MIT License
525 stars 103 forks source link

transformUrl not working? #90

Closed ehorodyski closed 9 years ago

ehorodyski commented 9 years ago

Sorry to post such a simple question, but I want to make sure I'm writing my statement correctly. What I'm trying to do is append a timestamp to each .html file being put into the template cache, to try to cachebust it on the fly since our templateCache task is being watched for changes and recompiles as we edit HTML files.

This is how I'm approaching the statement (I'm using gulp-util so that's why the module name looks funny:

.pipe($.angularTemplatecache('templates.js', { transformUrl: function (url) { return url + '?' + date.toJSON(); } }))

Along with the full task:

gulp.task('template', function() {

    var date = new Date();
    return gulp.src(config.dir.ngDev + '**/*.html')
        .pipe($.plumber({ errorHandler: onError }))
        .pipe($.angularTemplatecache('templates.js', { transformUrl: function (url) { return url + '?' + date.toJSON(); } }))
        .pipe(gulp.dest(dest.ngCompiled));

});
vigie commented 9 years ago

Was having the same issue, but updating my version (from 1.5 to 1.7) solved this for me. Looks like transformUrl was not introduced until April this year.

Try updating.

miickel commented 9 years ago

@ehorodyski did updating solve your problems with transformUrl?

elgervb commented 9 years ago

Got the same issue, but it was resolved when updating ;-)

miickel commented 9 years ago

cool, I'll close this now. thanks all