-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
executable file
·91 lines (81 loc) · 2.07 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
/* global module:false */
module.exports = function(grunt) {
var port = grunt.option('port') || 8000;
function TextBlockFilter(node) {
this.node = node;
}
TextBlockFilter.prototype.visit = function(node){
// first this is called with a node containing all the block's lines
// as sub-nodes, with their first word interpreted as the node's name
//
// so here, collect all the nodes' text (including its name)
// into a single Text node, and then visit that instead.
// the child nodes won't be visited - we're cutting them out of the
// parse tree
var text = new jade.nodes.Text();
for (var i=0; i < node.length; i++) {
text.push (node[i].name + (node[i].text ? node[i].text[0] : ""));
}
this.visitNode (text);
};
// Project configuration
grunt.loadNpmTasks( 'grunt-contrib-watch' );
grunt.loadNpmTasks( 'grunt-contrib-connect' );
grunt.loadNpmTasks( 'grunt-contrib-jade' );
grunt.loadNpmTasks( 'grunt-contrib-sass' );
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: port,
base: '.',
debug: true
}
}
},
jade: {
compile: {
options: {
filters: require('./filters.js'),
pretty: true,
data: {
debug: false
}
},
files: [{
expand: true,
src: [ '**/*.jade', '!shared/**' ],
ext: '.html'
}]
}
},
sass: {
dist: {
files: [{
expand: true,
src: ['**/*.scss', '!bower_components/**/*.scss'],
ext: '.css'
}]
}
},
watch: {
sass: {
files: ['**/*.scss'],
tasks: 'sass',
options:{
livereload: 35729
}
},
jade: {
files: ['**/*.jade'],
tasks: 'jade',
options:{
livereload: 35729
}
}
}
});
// Serve presentation locally
grunt.registerTask( 'serve', ['jade', 'connect', 'watch' ] );
};