forked from leemunroe/grunt-email-workflow
/
Gruntfile.js
79 lines (68 loc) · 2.21 KB
/
Gruntfile.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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Takes your scss files and compiles them to css
sass: {
dist: {
options: {
style: 'expanded'
},
files: {
'src/css/main.css': 'src/css/scss/main.scss',
'src/css/responsive.css': 'src/css/scss/responsive.scss'
}
}
},
// Assembles your email content with html layout
assemble: {
options: {
layoutdir: 'src/layouts',
flatten: true
},
pages: {
src: ['src/emails/*.hbs'],
dest: 'dist/'
}
},
// Inlines your css
premailer: {
simple: {
options: {
removeComments: true
},
files: [{
expand: true,
src: ['dist/*.html'],
dest: ''
}]
}
},
// Watches for changes to css or email templates then runs grunt tasks
watch: {
files: ['src/css/scss/*','src/emails/*','src/layouts/*'],
tasks: ['default']
},
// Use Mailgun option if you want to email the design to your inbox or to something like Litmus
mailgun: {
mailer: {
options: {
key: 'MAILGUN_KEY', // Enter your Mailgun API key here
sender: 'lee@leemunroe.com',
recipient: 'lee@leemunroe.com',
subject: 'This is a test email'
},
src: ['dist/'+grunt.option('template')]
}
},
});
// Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('assemble');
grunt.loadNpmTasks('grunt-mailgun');
grunt.loadNpmTasks('grunt-premailer');
grunt.loadNpmTasks('grunt-contrib-watch');
// Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['sass','assemble','premailer']);
// Use grunt send if you want to actually send the email to your inbox
grunt.registerTask('send', ['default','mailgun']);
};