-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
166 lines (150 loc) · 4.46 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// concat: {
// options: {
// separator: '\n\n\n\n\n\n\n\n'
// },
// dist: {
// src: ['js/<%= pkg.name %>.js'],
// dest: 'js/<%= pkg.name %>.js'
// }
// },
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'<%= pkg.buildDir %>/js/<%= pkg.name %>.min.js': ['<%= pkg.buildDir %>/js/<%= pkg.name %>.js']
}
}
},
qunit: {
files: ['<%= pkg.buildDir %>/kitchensink.html']
},
jshint: {
files: ['Gruntfile.js', '<%= pkg.buildDir %>/js/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
coffee: {
compile: {
files: {
'<%= pkg.buildDir %>/js/jtmpl.js': ['src/coffee/*.coffee.md'],
'<%= pkg.buildDir %>/js/tests.js': ['src/tests/*.coffee']
}
}
},
less: {
css: {
src: ['src/less/*.less'],
dest: '<%= pkg.buildDir %>/css/styles.css',
}
},
sass: {
dist: {
files: {
'<%= pkg.buildDir %>/css/styles.css' : 'src/sass/style.scss'
}
}
},
watch: {
jshint: {
files: ['<%= jshint.files %>'],
tasks: ['jshint', 'concat', 'uglify', 'copy:tests']
},
coffee: {
files: ['src/coffee/*.coffee', 'src/coffee/*.litcoffee', 'src/coffee/*.coffee.md', 'src/tests/*.litcoffee', 'src/tests/*.coffee.md', 'src/tests/*.coffee'],
tasks: ['coffee', 'concat', 'uglify']
},
less: {
files: ['src/less/*.less'],
tasks: ['less']
},
sass: {
files: ['src/sass/*.scss'],
tasks: ['sass']
},
markdown: {
files: ['*.md', 'src/coffee/jtmpl.coffee.md'],
tasks: ['md2html'],
options: {
nospawn: true
}
},
templates: {
files: ['src/templates/*'],
tasks: ['md2html']
}
},
connect: {
server: {
options: {
port: 8000,
hostname: '0.0.0.0',
base: '<%= pkg.buildDir %>/',
}
}
},
copy: {
main: {
files: [
{src: 'CNAME', dest: '<%= pkg.buildDir %>/CNAME'},
{src: 'favicon.ico', dest: '<%= pkg.buildDir %>/favicon.ico'},
{src: 'hello.html', dest: '<%= pkg.buildDir %>/hello.html'},
{src: 'kitchensink.html', dest: '<%= pkg.buildDir %>/kitchensink.html'},
{src: 'src/js/highlight-coffee.js', dest: '<%= pkg.buildDir %>/js/highlight-coffee.js'},
{src: 'bower_components/qunit/qunit/qunit.js', dest: '<%= pkg.buildDir %>/js/qunit.js'},
{src: 'bower_components/qunit/qunit/qunit.css', dest: '<%= pkg.buildDir %>/css/qunit.css'},
{src: 'bower_components/highlightjs/highlight.pack.js', dest: '<%= pkg.buildDir %>/js/highlight.min.js'},
{src: 'bower_components/highlightjs/styles/solarized_dark.css', dest: '<%= pkg.buildDir %>/css/highlight.css'}
]
}
},
md2html: {
multiple_files: {
options: {
layout: 'src/templates/layout.html'
},
files: [{
expand: true,
cwd: './',
src: ['*.md', 'src/**/*.md'],
dest: 'gh-pages',
ext: '.html'
}]
}
},
'gh-pages': {
options: {
base: 'gh-pages'
},
src: ['**']
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-dotlit');
grunt.loadNpmTasks('grunt-md2html');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.registerTask('default', ['coffee', 'less', 'uglify', 'copy', 'md2html', 'connect', 'watch']);
grunt.registerTask('build', ['coffee', 'less', 'uglify', 'copy', 'md2html']);
grunt.registerTask('publish', ['build', 'gh-pages']);
};