-
Notifications
You must be signed in to change notification settings - Fork 548
/
Gruntfile.js
129 lines (120 loc) · 3.09 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
128
129
module.exports = function(grunt) {
'use strict';
var fs = require('fs');
grunt.initConfig({
uglify: {
options: {
mangle: false
},
my_target: {
files: {
'dist/timesheet.min.js': ['source/javascripts/timesheet.js']
}
}
},
sass: {
gh: {
options: {
style: 'compressed'
},
files: {
'gh-pages/styles/style.css': 'source/stylesheets/style.sass'
}
},
dist: {
options: {
style: 'compressed'
},
files: {
'dist/timesheet.min.css': 'source/stylesheets/timesheet.sass',
'dist/timesheet-white.min.css': 'source/stylesheets/timesheet-white.sass'
}
}
},
jshint: {
all: {
src: [
'source/javascripts/*.js'
],
options: {
jshintrc: '.jshintrc'
}
}
},
simplemocha: {
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
grep: '',
ui: 'tdd',
reporter: 'spec'
},
all: { src: ['test/**/*.js'] }
},
express: {
options: {
port: 8080
},
dev: {
options: {
script: __dirname + '/serve.js'
}
}
},
watch: {
scripts: {
files: 'source/javascripts/*.js',
tasks: ['simplemocha', 'jshint', 'uglify'],
options: {
interrupt: true,
}
},
styles: {
files: 'source/stylesheets/*.sass',
tasks: ['sass'],
options: {
interrupt: true,
}
}
},
haml: {
gh: {
files: {
'gh-pages/index.html': 'source/index.haml'
},
options: {
context: {
code: fs.readFileSync(__dirname + '/source/snippets/example-date.js')
}
}
}
},
copy: {
gh: {
files: [
{expand: false, src: __dirname + '/source/javascripts/lib.js', dest: __dirname + '/gh-pages/script/lib.js'},
{expand: false, src: __dirname + '/source/javascripts/main.js', dest: __dirname + '/gh-pages/script/main.js'},
{expand: false, src: __dirname + '/dist/timesheet.min.js', dest: __dirname + '/gh-pages/script/timesheet.min.js'},
{expand: false, src: __dirname + '/dist/timesheet.min.css', dest: __dirname + '/gh-pages/styles/timesheet.css'},
{expand: false, src: __dirname + '/dist/timesheet-white.min.css', dest: __dirname + '/gh-pages/styles/timesheet-white.css'},
{expand: false, src: __dirname + '/dist/timesheet.min.css.map', dest: __dirname + '/gh-pages/styles/timesheet.css.map'},
{expand: false, src: __dirname + '/dist/timesheet-white.min.css.map', dest: __dirname + '/gh-pages/styles/timesheet-white.css.map'}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-express-server');
grunt.loadNpmTasks('grunt-haml');
// Default task
grunt.registerTask('default', ['build']);
grunt.registerTask('build', ['simplemocha', 'jshint', 'uglify', 'sass']);
grunt.registerTask('server', ['express:dev', 'watch' ])
grunt.registerTask('gh', ['build', 'haml:gh', 'sass:gh', 'copy:gh']);
};