-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgulpfile.js
91 lines (77 loc) · 2.36 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var gulp = require('gulp');
var jscs = require('gulp-jscs');
var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
var jshint = require('gulp-jshint');
var es = require('event-stream');
var options = {
emailTest : {
email : process.env.GMAIL_USER,
subject : 'Email Subject',
nodemailer: {
transporter: {
service: 'gmail',
auth: {
user: process.env.GMAIL_USER,
pass: process.env.GMAIL_PASS
}
}
}
},
litmus : {
subject : 'Custom subject line',
username : process.env.LIT_USER,
password : process.env.LIT_PASS,
url : process.env.LIT_URL,
applications : ['gmailnew', 'hotmail', 'outlookcom', 'ol2000', 'ol2002', 'ol2003', 'ol2007', 'ol2010','ol2011', 'ol2013', 'appmail8', 'iphone5', 'ipad3']
},
encodeSpecialChars: true,
};
var EmailBuilder = require('./lib/emailBuilder');
gulp.task('email', function() {
var emailBuilder = new EmailBuilder(options);
return gulp.src(['test/fixtures/input/embedded_styles_inlined.html'])
.pipe(es.map(function(data, cb) {
emailBuilder.sendEmailTest(data.contents)
.then(function() {
cb(null, data);
});
}));
});
gulp.task('litmus', function() {
var emailBuilder = new EmailBuilder(options);
return gulp.src(['test/fixtures/input/embedded_styles_inlined.html'])
.pipe(es.map(function(data, cb) {
emailBuilder.sendLitmusTest(data.contents)
.then(function() {
cb(null, data);
});
}));
});
// Run this task to create the `output` fixtures
// to test against the `input` fixtures
gulp.task('inline', function() {
var emailBuilder = new EmailBuilder(options);
return gulp.src(['test/fixtures/input/*.html'])
.pipe(es.map(function(data, cb) {
emailBuilder.inlineCss(data.path)
.then(function(html) {
data.contents = new Buffer(html);
cb(null, data);
});
}))
.pipe(gulp.dest('./test/fixtures/output'));
});
gulp.task('lint', function() {
return gulp.src(['./lib/**/*.js', 'gulpfile.js'])
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jscs());
});
gulp.task('test', ['lint'], function() {
return gulp.src(['test/specs/*.js'], {read: false})
.pipe(mocha({reporter: 'spec'}));
});
gulp.task('watch', function() {
return gulp.watch(['./lib/**/*.js', 'gulpfile.js'], ['test']);
});