-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
76 lines (67 loc) · 2.05 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
concat = require('gulp-concat'),
less = require('gulp-less'),
watch = require('gulp-watch'),
livereload = require('gulp-livereload'),
handlebars = require('gulp-ember-handlebars'),
header = require('gulp-header'),
runSequence = require('run-sequence'),
pkg = require('./package.json');
var banner = [
'// ==========================================================================',
'// Project: Ember D3 Component',
'// Version v<%= pkg.version %>',
'// Copyright: © 2014 Antoine Moser',
'// License: MIT (see LICENSE)',
'// ==========================================================================\n',
].join('\n');
var paths = {
templates: 'lib/templates/**/*.hbs',
scripts: [
'lib/templates-top.js',
'lib/components/*.js'
],
// js: 'dist/js/*.js',
styles: 'lib/styles/ember-d3.less',
dist: 'dist/**/*.*'
};
gulp.task('templates', function() {
gulp.src([paths.templates])
.pipe(handlebars({
outputType: 'browser',
namespace: 'Ember.TEMPLATES'
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest('tmp'));
});
gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(concat('components.js'))
.pipe(gulp.dest('tmp'));
});
gulp.task('release', function() {
gulp.src([
'tmp/components.js'
])
.pipe(concat('ember-d3.js'))
.pipe(header(banner, { pkg: pkg }))
.pipe(gulp.dest('dist/js/'));
});
gulp.task('styles', function() {
return gulp.src(paths.styles)
.pipe(less())
.pipe(gulp.dest('dist/css/'));
});
gulp.task('watch', function() {
var server = livereload();
var changed = function(file) {
server.changed(file.path);
};
gulp.watch(paths.scripts, ['scripts', 'release']);
gulp.watch(paths.templates, ['templates']);
gulp.watch(paths.styles, ['styles']);
// gulp.watch(paths.js).on('change', changed);
gulp.watch(paths.dist).on('change', changed);
});
gulp.task('default', ['templates', 'scripts', 'styles', 'release']);