Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem Minifying HTML and Putting in $templatecache #18

Open
mdixon47 opened this issue Jul 22, 2015 · 2 comments
Open

Problem Minifying HTML and Putting in $templatecache #18

mdixon47 opened this issue Jul 22, 2015 · 2 comments

Comments

@mdixon47
Copy link

I am having an issue while running gulp templatecache. I have installed the dependencies gulp-angular-templatecache and gulp-minify-html. I have also added the information in the gulp.config.js file.

TYPEERROR: undefined is not a function

Assistance would be greatly appreciated.

gulpfile.js --->

gulp.task('templatecache',['clean-code'], function() {
log('Creating an AngularJS $templateCache');
return gulp
.src(config.htmltemplates)
.pipe($.minifyHtml({empty: true}))
.pipe($.angularTemplatecache(config.templateCache.file, config.templateCache.options))
.pipe(gulp.dest(config.temp));
});

gulp.config.js --->

htmltemplates: clientApp + '*/.html',
templateCache: {
file: 'templates.js',
options: {
module: 'app.core',
standAlone: false,
root: 'app/'
}
},

console info and error ---->

➜ pluralsight-gulp git:(master) ✗ gulp templatecache
[10:25:39] Using gulpfile ~/sites/pluralsight-gulp/gulpfile.js
[10:25:39] Starting 'clean-code'...
[10:25:39] Cleaning: ./.tmp//*.js,./build//.html,./build/js/__/.js
[10:25:39] Finished 'clean-code' after 82 ms
[10:25:39] Starting 'templatecache'...
[10:25:39] Creating an AngularJS $templateCache
[10:25:39] 'templatecache' errored after 7.49 ms
[10:25:39] TypeError: undefined is not a function
at Gulp. (/Users/malikdixon1/sites/pluralsight-gulp/gulpfile.js:110:19)
at module.exports (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at /Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/index.js:279:18
at finish (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at cb (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:29:3)
at /Users/malikdixon1/sites/pluralsight-gulp/node_modules/del/index.js:54:4
at module.exports (/Users/malikdixon1/sites/pluralsight-gulp/node_modules/del/node_modules/each-async/index.js:22:3)
at /Users/malikdixon1/sites/pluralsight-gulp/node_modules/del/index.js:40:3

@elisheva50
Copy link

I compared what you have to what I have, and found this difference: I have:

htmltemplates: clientApp + '*/.html',

and you are missing the '**/'

I'm not sure if that is the issue though, because I tried changing my code to match yours and I didn't get an error.

@ghost
Copy link

ghost commented Aug 21, 2015

With these gulp versions it works fine:

    "gulp-angular-templatecache": "^1.7.0",
    "gulp-minify-html": "^1.0.4",

What @elisheva50 said, your config.templates value should be **/*.html (notice the stars).
If I try your config (gulp.config.js) (code is fine btw), with my gulp tasks versions, I don't get an error, but... the template.js don't get build. I hope it helps.

Another thing that is different from mine, your clean code comment:
Yours:

[10:25:39] Starting 'clean-code'...
[10:25:39] Cleaning: ./.tmp//*.js,./build//.html,./build/js//.js

Mine:

[14:49:59] Starting 'clean-code'...
[14:49:59] Cleaning: ./.tmp/**/*.js,./build/**/*.html,./build/js/**/*.js

Notice the second line (folder structure). I think you are forgetting a lot of stars, please post your full gulp config file with the correct markdown code tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants