Answer the question
In order to leave comments, you need to log in
Laravel Elixir + require angular?
Hello. There is a site on the latest laravel'e (5.2), it costs elixir, bower, npm, node. Actually I'm trying to fasten elixir-angular-template-cache from npm'a. There is this code:
var elixir = require('laravel-elixir');
require('elixir-angular-template-cache');
elixir(function(mix) {
mix.angulartemplatecache({
standalone: true
}, 'resources/assets/js/app/templates/**/*.html', 'resources/assets/js/app');
});
TypeError: mix.angulartemplatecache is not a function
. Moreover, if I insert the contents of the index.js file of that same module directly into gulpfile.js - everything works! It doesn't work if you use the require. construct. I don't understand what's wrong. Answer the question
In order to leave comments, you need to log in
I'm not sure if this is correct, but I did it this way.
I did not use the elixir package, because they often work with errors.
Nothing prevents you from using "gulp-angular-templatecache", which works 100%
The implementation turned out like this
var gulp = require('gulp');
var templateCache = require('gulp-angular-templatecache');
var Task = elixir.Task;
// Создание новой задачи
elixir.extend('templateCache', function() {
new Task('templateCache', function() {
return gulp.task('templateCache', function () {
return gulp.src('resources/assets/js/**/*.html')
.pipe(templateCache('templateCache.js', { module:'app'}))
.pipe(gulp.dest('resources/assets/js/'));
});
}).watch('resources/assets/js/**/*.html');
});
elixir(function(mix) {
// Добавляем задачу в микс
mix.templateCache();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question