-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1 Make compatible with laravel-elixir 3.0
- Loading branch information
Peter Reisz
committed
Jul 31, 2015
1 parent
a7c4d87
commit 4a67a3d
Showing
3 changed files
with
39 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,39 @@ | ||
var gulp = require('gulp'), | ||
gulpIf = require('gulp-if'), | ||
sourcemap = require('gulp-sourcemaps'), | ||
htmlmin = require('gulp-htmlmin'), | ||
templateCache = require('gulp-angular-templatecache'), | ||
extend = require('extend'), | ||
extend = require('extend'), | ||
htmlmin = require('gulp-htmlmin'), | ||
templateCache = require('gulp-angular-templatecache'), | ||
elixir = require('laravel-elixir'), | ||
utilities = require('laravel-elixir/ingredients/commands/Utilities'), | ||
Notification = require('laravel-elixir/ingredients/commands/Notification'); | ||
gulpIf = elixir.Plugins.if, | ||
sourcemap = elixir.Plugins.sourcemaps, | ||
config = elixir.config; | ||
|
||
elixir.extend('ngTemplateCache', function(src, outputDir, baseDir, options) { | ||
elixir.extend('ngTemplateCache', function(src, output, baseDir, options) { | ||
|
||
var config = elixir.config, | ||
baseDir = baseDir || config.assetsDir + 'templates', | ||
filePattern = '/**/*.html'; | ||
options = extend(true, { | ||
templateCache: { | ||
standalone: true | ||
}, | ||
htmlmin: { | ||
collapseWhitespace: true, | ||
removeComments: true | ||
} | ||
}, options); | ||
|
||
options = extend(true, { | ||
templateCache: { | ||
standalone: true | ||
}, | ||
htmlmin: { | ||
collapseWhitespace: true, | ||
removeComments: true | ||
} | ||
}, options); | ||
var sources = (baseDir || config.assetsPath + '/templates') + (src || '/**/*.html'), | ||
paths = new elixir.GulpPaths() | ||
.src(sources) | ||
.output(output || config.get('public.js.outputFolder')); | ||
|
||
src = utilities.buildGulpSrc(src, baseDir, filePattern); | ||
new elixir.Task('ngTemplateCache', function() { | ||
|
||
gulp.task('ngTemplateCache', function() { | ||
return gulp.src(src) | ||
.pipe(gulpIf(config.sourcemaps, sourcemap.init())) | ||
.pipe(gulpIf(config.production, htmlmin(options.htmlmin))) | ||
.pipe(templateCache(options.templateCache)) | ||
.pipe(gulpIf(config.sourcemaps, sourcemap.write('.'))) | ||
.pipe(gulp.dest(outputDir || config.jsOutput)) | ||
.pipe(new Notification().message('Angular templatecache generated.')); | ||
}); | ||
return gulp.src(paths.src.path) | ||
.pipe(gulpIf(config.sourcemaps, sourcemap.init())) | ||
.pipe(gulpIf(config.production, htmlmin(options.htmlmin))) | ||
.pipe(templateCache(options.templateCache)) | ||
.pipe(gulpIf(config.sourcemaps, sourcemap.write('.'))) | ||
.pipe(gulp.dest(paths.output.baseDir)) | ||
.pipe(new elixir.Notification('Angular templatecache generated.')); | ||
|
||
this.registerWatcher('ngTemplateCache', baseDir + filePattern); | ||
}).watch(sources); | ||
|
||
return this.queueTask('ngTemplateCache'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters