-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
100 lines (84 loc) · 3.49 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
92
93
94
95
96
97
98
99
100
// =============================================================================
// GULPFILE.JS / Custom gulp functions
// =============================================================================
// Initialize gulp
// -----------------------------------------------------------------------------
var gulp = require('gulp'),
haml = require('gulp-ruby-haml'),
inlineCss = require('gulp-inline-css'),
litmus = require('gulp-litmus');
sass = require('gulp-sass');
// Compile src/*.scss to build/*.css
// -----------------------------------------------------------------------------
gulp.task('sass', function() {
return gulp.src('src/sass/*.scss')
.pipe(sass())
.pipe(gulp.dest('build/css/.'));
});
// Compile src/*.haml to build/*.html
// -----------------------------------------------------------------------------
gulp.task('haml', function() {
return gulp.src(['src/haml/*.haml', 'src/haml/modules/*.haml', 'src/haml/templates/marketing/*/*.haml', 'src/haml/templates/transactional/*.haml'])
.pipe(haml())
.pipe(gulp.dest('build/.'));
});
// Compile src/*.scss to build/*.css
// -----------------------------------------------------------------------------
gulp.task('inline', ['sass', 'haml'], function() {
return gulp.src(['build/*.html'])
.pipe(inlineCss())
.pipe(gulp.dest('build/.'));
});
// Compile sass, and haml, inline styles and dispatch new test to Litmus
// -----------------------------------------------------------------------------
gulp.task('build', ['inline', 'sass', 'haml', 'test'], function() {
return gulp.src(['build/*.html'])
.pipe(gulp.dest('build/.'));
});
// Automatically compile stylesheet(s) and haml while inlining
// -----------------------------------------------------------------------------
gulp.task('watch', function() {
gulp.watch('src/sass/*.scss', ['build']);
gulp.watch(['src/haml/modules/*.haml', 'src/haml/templates/transactional/*.haml', 'src/haml/templates/marketing/**/*.haml'], ['build']);
});
// Configure Litmus email testing tool
// -----------------------------------------------------------------------------
//
// Include Your Litmus Username, Password, Our Organization's URL and List Of Emails You Want To Test Against
// List of Available Testing Clients Can Be Found Here ~> https://YOURAPPLICATIONNAME.litmus.com/emails/clients.xml
// Pick The Clients You Want To Test Against, Copy Their <application_code> And Add It To The Array Of applications: [] below
//
// REFERENCES
// -----------------------------------------------------------------------------
//
// * https://litmus.com
//
// -----------------------------------------------------------------------------
var config = {
username: 'YOURLITMUSUSERNAME',
password: 'YOURLITMUSPASSWORD',
url: 'https://YOURAPPLICATIONNAME.litmus.com',
applications: [
'appmail8',
'gmailnew',
'ffgmailnew',
'chromegmailnew',
'iphone5s',
]
}
// Test emails across different applications, browsers and devices
// -----------------------------------------------------------------------------
//
// See test using name and password inside 'Litmus Email Testing Config'
//
// REFERENCES
// -----------------------------------------------------------------------------
//
// * https://litmus.com/checklist/
//
// -----------------------------------------------------------------------------
gulp.task('test', function () {
return gulp.src('build/index.html')
.pipe(litmus(config))
.pipe(gulp.dest('build/.'));
});