0

I'm having serious problems getting gulp-angular-templatecache to work nicely within my app. I'm using the HotTowel yeomen generator and I modified it a little bit, but I can't seem to get my template cache to use a different module name. Here's the relevant gulpfile code:

gulp.task('templatecache', ['clean-code'], function() {
    log('Creating an AngularJS $templateCache');

    return gulp
        .src(config.htmltemplates)
        .pipe($.if(args.verbose, $.bytediff.start()))
        .pipe($.minifyHtml({empty: true}))
        .pipe($.if(args.verbose, $.bytediff.stop(bytediffFormatter)))
        .pipe($.angularTemplatecache(
            'templates.js',
            {
                module: 'app.templates',
                standalone: true,
                root: 'app/',
                moduleSystem: 'IIFE'
            }
        ))
        .pipe(gulp.dest(config.temp));
});

The original HotTowel gulpfile had {module: 'app.core', standalone: false, root: 'app/'} as the options. Every time I run the build process, my stupid templates.js file looks like this: angular.module("app.core").run(["$templateCache"....

I've tried so many things to change it, but it never goes to app.templates. Any ideas?

exk0730
  • 733
  • 5
  • 20
  • its in here: config.htmltemplates – omarjmh Apr 07 '16 at 18:31
  • config.htmltemplates only points to all of my HTML files in my app. It would be `gulp.src('./src/client/app/**/*.html')`. The gulp task is minifying all of those files, then running them through `gulp-angular-templatecache`, so I don't see how that would affect the module that's being defined. – exk0730 Apr 07 '16 at 18:41
  • this is going to sound silly, but have you checked that your gulpfile is actually being executed? Because there's no particular anything that would cause it to default to `app.core` - the default module in the gulp library is actually `templates`. – pfooti Apr 07 '16 at 21:25
  • Yup! Checked that using the `transformUrl` option and just `console.log`ing every template URL that I get from the gulp task - all of my directive/component template URLs are being printed correctly. – exk0730 Apr 08 '16 at 11:55

0 Answers0