-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
127 lines (123 loc) · 4.33 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
(function () {
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// show elapsed time at the end
require('time-grunt')(grunt);
// load all grunt tasks
require('load-grunt-tasks')(grunt);
// configurable paths
var yeomanConfig = {
app: 'src',
dist: 'dist',
temp: '.tmp'
};
grunt.initConfig({
yeoman: yeomanConfig,
watch: {
options: {
nospawn: true,
livereload: {liveCSS: false}
},
livereload: {
options: {
livereload: true
},
files: [
'<%= yeoman.app %>/*.html',
'<%= yeoman.app %>/**/*.js',
'<%= yeoman.app %>/**/*.css'
]
}
},
connect: {
options: {
port: 9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
livereload: {
options: {
middleware: function (connect) {
return [
lrSnippet,
mountFolder(connect, yeomanConfig.temp),
mountFolder(connect, yeomanConfig.dist),
mountFolder(connect, '/'),
mountFolder(connect, '.')
];
}
}
},
test: {
options: {
open: {
target: 'http://localhost:<%= connect.options.port %>/'
},
middleware: function (connect) {
return [
mountFolder(connect, yeomanConfig.temp),
mountFolder(connect, yeomanConfig.dist),
mountFolder(connect, '.')
];
},
keepalive: true
}
}
},
clean: {
dist: ['.tmp', '<%= yeoman.dist %>/*']
},
concat: {
styles: {
src: [
'bower_components/reveal-js/css/reveal.min.css',
'bower_components/reveal-js/css/theme/default.css',
'bower_components/reveal-js/lib/css/zenburn.css',
'<%= yeoman.app %>/styles/custom.css'
],
dest: '<%= yeoman.temp %>/built.css'
},
scripts: {
src: [
'<%= yeoman.app %>/scripts/print-pdf.js',
'bower_components/jquery/dist/jquery.min.js',
'bower_components/reveal-js/js/reveal.min.js',
'<%= yeoman.app %>/scripts/custom.js'
],
dest: '<%= yeoman.temp %>/built.js'
}
},
includes: {
files: {
src: ['<%= yeoman.app %>/ssReveal-footer.html','<%= yeoman.app %>/ssReveal-header.html'], // Source files
dest: '<%= yeoman.dist %>', // Destination directory
flatten: true,
cwd: '.'
}
}
});
// Polymer Yeoman Tasks
grunt.registerTask('build', [
'clean:dist',
'concat:styles',
'concat:scripts',
'includes'
]);
grunt.registerTask('serve', [
'clean:dist',
'concat:styles',
'concat:scripts',
'includes',
'connect:test'
]);
grunt.registerTask('default', [
// 'test'
'build'
]);
};
}());