Skip to content

Commit c75374b

Browse files
committed
Merge pull request #91 from cameronprattedwards/modularize-gulp
Modularize gulp
2 parents 0b84c61 + e76da7a commit c75374b

File tree

12 files changed

+120
-100
lines changed

12 files changed

+120
-100
lines changed

dist/schema-form.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ angular.module('schemaForm').provider('sfPath',
4444
this.parse = ObjectPath.parse;
4545
this.stringify = ObjectPath.stringify;
4646
this.normalize = ObjectPath.normalize;
47-
this.$get = function () {
47+
this.$get = function() {
4848
return ObjectPath;
4949
};
5050
}]);
@@ -55,7 +55,7 @@ angular.module('schemaForm').provider('sfPath',
5555
* @kind function
5656
*
5757
*/
58-
angular.module('schemaForm').factory('sfSelect', ['sfPath', function (sfPath) {
58+
angular.module('schemaForm').factory('sfSelect', ['sfPath', function(sfPath) {
5959
var numRe = /^\d+$/;
6060

6161
/**

gulp/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var fs = require('fs'),
2+
tasks = fs.readdirSync('./gulp/tasks'),
3+
gulp = require('gulp');
4+
5+
tasks.forEach(function(task) {
6+
require('./tasks/' + task);
7+
});

gulp/tasks/bootstrap-datepicker.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var gulp = require('gulp'),
2+
streamqueue = require('streamqueue'),
3+
minifyHtml = require('gulp-minify-html'),
4+
templateCache = require('gulp-angular-templatecache'),
5+
concat = require('gulp-concat'),
6+
uglify = require('gulp-uglify');
7+
8+
gulp.task('bootstrap-datepicker', function() {
9+
var stream = streamqueue({objectMode: true});
10+
stream.queue(
11+
gulp.src('./src/directives/decorators/bootstrap/datepicker/*.html')
12+
.pipe(minifyHtml({
13+
empty: true,
14+
spare: true,
15+
quotes: true
16+
}))
17+
.pipe(templateCache({
18+
module: 'schemaForm',
19+
root: 'directives/decorators/bootstrap/datepicker/'
20+
}))
21+
);
22+
stream.queue(gulp.src('./src/directives/decorators/bootstrap/datepicker/*.js'));
23+
24+
stream.done()
25+
.pipe(concat('bootstrap-datepicker.min.js'))
26+
.pipe(uglify())
27+
.pipe(gulp.dest('./dist/'));
28+
29+
});

gulp/tasks/bootstrap.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
var gulp = require('gulp'),
2+
streamqueue = require('streamqueue'),
3+
minifyHtml = require('gulp-minify-html'),
4+
templateCache = require('gulp-angular-templatecache'),
5+
concat = require('gulp-concat'),
6+
uglify = require('gulp-uglify');
7+
8+
gulp.task('bootstrap', function() {
9+
var stream = streamqueue({objectMode: true});
10+
stream.queue(
11+
gulp.src('./src/directives/decorators/bootstrap/*.html')
12+
.pipe(minifyHtml({
13+
empty: true,
14+
spare: true,
15+
quotes: true
16+
}))
17+
.pipe(templateCache({
18+
module: 'schemaForm',
19+
root: 'directives/decorators/bootstrap/'
20+
}))
21+
);
22+
stream.queue(gulp.src('./src/directives/decorators/bootstrap/*.js'));
23+
24+
stream.done()
25+
.pipe(concat('bootstrap-decorator.min.js'))
26+
.pipe(uglify())
27+
.pipe(gulp.dest('./dist/'));
28+
29+
});

gulp/tasks/default.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
var gulp = require('gulp');
2+
3+
gulp.task('default', [
4+
'minify',
5+
'bootstrap',
6+
'bootstrap-datepicker',
7+
'non-minified-dist'
8+
]);

gulp/tasks/jscs.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var gulp = require('gulp'),
2+
jscs = require('gulp-jscs');
3+
4+
gulp.task('jscs', function() {
5+
gulp.src('./src/**/*.js')
6+
.pipe(jscs());
7+
});

gulp/tasks/minify.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
var gulp = require('gulp'),
2+
concat = require('gulp-concat'),
3+
uglify = require('gulp-uglify');
4+
5+
gulp.task('minify', function() {
6+
gulp.src([
7+
'./src/module.js',
8+
'./src/sfPath.js',
9+
'./src/services/*.js',
10+
'./src/directives/*.js'
11+
])
12+
.pipe(concat('schema-form.min.js'))
13+
.pipe(uglify())
14+
.pipe(gulp.dest('./dist/'));
15+
});

gulp/tasks/non-minified-dist.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var gulp = require('gulp'),
2+
concat = require('gulp-concat');
3+
4+
gulp.task('non-minified-dist', function() {
5+
gulp.src([
6+
'./src/module.js',
7+
'./src/sfPath.js',
8+
'./src/services/*.js',
9+
'./src/directives/*.js'
10+
])
11+
.pipe(concat('schema-form.js'))
12+
.pipe(gulp.dest('./dist/'));
13+
});

gulp/tasks/watch.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var gulp = require('gulp');
2+
3+
gulp.task('watch', function() {
4+
gulp.watch('./src/**/*', ['default']);
5+
});

gulpfile.js

Lines changed: 3 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,4 @@
1-
/* global require */
1+
//all of the tasks themselves are contained in the gulp/tasks directory,
2+
//which is accessed through gulp/index.js
23

3-
var gulp = require('gulp');
4-
5-
var templateCache = require('gulp-angular-templatecache');
6-
var minifyHtml = require('gulp-minify-html');
7-
var concat = require('gulp-concat');
8-
var uglify = require('gulp-uglify');
9-
var streamqueue = require('streamqueue');
10-
var jscs = require('gulp-jscs');
11-
12-
13-
14-
gulp.task('bootstrap', function() {
15-
var stream = streamqueue({objectMode: true});
16-
stream.queue(
17-
gulp.src('./src/directives/decorators/bootstrap/*.html')
18-
.pipe(minifyHtml({
19-
empty: true,
20-
spare: true,
21-
quotes: true
22-
}))
23-
.pipe(templateCache({
24-
module: 'schemaForm',
25-
root: 'directives/decorators/bootstrap/'
26-
}))
27-
);
28-
stream.queue(gulp.src('./src/directives/decorators/bootstrap/*.js'));
29-
30-
stream.done()
31-
.pipe(concat('bootstrap-decorator.min.js'))
32-
.pipe(uglify())
33-
.pipe(gulp.dest('./dist/'));
34-
35-
});
36-
37-
gulp.task('bootstrap-datepicker', function() {
38-
var stream = streamqueue({objectMode: true});
39-
stream.queue(
40-
gulp.src('./src/directives/decorators/bootstrap/datepicker/*.html')
41-
.pipe(minifyHtml({
42-
empty: true,
43-
spare: true,
44-
quotes: true
45-
}))
46-
.pipe(templateCache({
47-
module: 'schemaForm',
48-
root: 'directives/decorators/bootstrap/datepicker/'
49-
}))
50-
);
51-
stream.queue(gulp.src('./src/directives/decorators/bootstrap/datepicker/*.js'));
52-
53-
stream.done()
54-
.pipe(concat('bootstrap-datepicker.min.js'))
55-
.pipe(uglify())
56-
.pipe(gulp.dest('./dist/'));
57-
58-
});
59-
60-
gulp.task('minify', function() {
61-
gulp.src([
62-
'./src/module.js',
63-
'./src/sfPath.js',
64-
'./src/services/*.js',
65-
'./src/directives/*.js'
66-
])
67-
.pipe(concat('schema-form.min.js'))
68-
.pipe(uglify())
69-
.pipe(gulp.dest('./dist/'));
70-
});
71-
72-
gulp.task('non-minified-dist', function() {
73-
gulp.src([
74-
'./src/module.js',
75-
'./src/sfPath.js',
76-
'./src/services/*.js',
77-
'./src/directives/*.js'
78-
])
79-
.pipe(concat('schema-form.js'))
80-
.pipe(gulp.dest('./dist/'));
81-
});
82-
83-
gulp.task('jscs', function() {
84-
gulp.src('./src/**/*.js')
85-
.pipe(jscs());
86-
});
87-
88-
gulp.task('default', [
89-
'minify',
90-
'bootstrap',
91-
'bootstrap-datepicker',
92-
'non-minified-dist'
93-
]);
94-
95-
gulp.task('watch', function() {
96-
gulp.watch('./src/**/*', ['default']);
97-
});
4+
require('./gulp');

0 commit comments

Comments
 (0)