-
Notifications
You must be signed in to change notification settings - Fork 26
/
Gruntfile.coffee
79 lines (71 loc) · 2.16 KB
/
Gruntfile.coffee
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 = (grunt) ->
grunt.initConfig
# Delete files that will be used by compile-handlebars because it appends to the end of a file rather than re-writing it.
clean: [ 'src/sass/_*-map.scss', 'index.html']
'compile-handlebars':
# Generate map SCSS files
'maps':
files: [
{
src: 'handlebars/templates/map-scss.handlebars',
dest: [
'src/sass/_icons-map.scss', 'src/sass/_ships-map.scss'
]
}
]
templateData: [
'src/json/icons-map.json',
'src/json/ships-map.json'
]
helpers: 'handlebars/helpers/*.js'
# Generate index.html from merged json
'index':
files: [
{
src: 'handlebars/templates/index.handlebars',
dest: 'index.html'
}
]
globals: [
'src/json/ships-map.json',
'src/json/icons-map.json'
]
partials: 'handlebars/templates/index-icon-set.handlebars'
sass:
compile:
expand: true
cwd: 'src/sass/'
src: ['*.scss']
dest: 'dist/'
ext: '.css'
'string-replace':
inline:
files: [
expand: true,
cwd: 'dist/',
src: '*.css',
dest: 'dist/'
]
options:
replacements: [
{
pattern: /\.\.\/fonts\//g,
replacement: ''
}
]
copy:
main:
files: [ {
expand: true,
cwd: 'src/fonts/',
src: '**',
dest: 'dist/',
filter: 'isFile'
}
]
grunt.loadNpmTasks 'grunt-contrib-clean'
grunt.loadNpmTasks 'grunt-compile-handlebars'
grunt.loadNpmTasks 'grunt-sass'
grunt.loadNpmTasks 'grunt-string-replace'
grunt.loadNpmTasks 'grunt-contrib-copy'
grunt.registerTask 'default', [ 'clean', 'compile-handlebars', 'sass', 'string-replace', 'copy' ]