Skip to content

Commit

Permalink
#1 Make compatible with laravel-elixir 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Reisz committed Jul 31, 2015
1 parent a7c4d87 commit 4a67a3d
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 39 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ This will require a file `BASEDIR/foo/bar.html`, so you don't have to put the `B

## Changelog

__0.2.0__
- Upgrade to laravel-elixir 3.0
- Upgrade dependencies


__0.1.0__
- Initial release

Expand Down
63 changes: 30 additions & 33 deletions index.js
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');
});
});
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "laravel-elixir-ngtemplatecache",
"version": "0.1.0",
"version": "0.2.0",
"description": "Laravel Elixir extension for generating AngularJS an templateCache module",
"main": "index.js",
"scripts": {
Expand All @@ -17,11 +17,9 @@
"contributors": [],
"license": "MIT",
"dependencies": {
"gulp-if": "^1.2.5",
"gulp-sourcemaps": "^1.3.0",
"gulp-angular-templatecache": "^1.5.0",
"gulp-htmlmin": "^1.1.1",
"extend": "^2.0.0"
"gulp-angular-templatecache": "^1.7.0",
"gulp-htmlmin": "^1.1.3",
"extend": "^3.0.0"
},
"devDependencies": {},
"repository": {
Expand Down

0 comments on commit 4a67a3d

Please sign in to comment.