-
Notifications
You must be signed in to change notification settings - Fork 1
/
grunt.js
153 lines (141 loc) · 4.53 KB
/
grunt.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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
requirejs: {
compile: {
options: {
// main file to start to look for its dependencies.
name: 'app',
baseUrl: "src/app",
mainConfigFile: "src/config.js",
optimize: "uglify",
out: "build/<%= pkg.bundle %>.min.js"
}
}
},
buster: {
test: {
config: 'test/buster.js',
reporter: 'xml',
'log-level': 'debug'
},
server: {
port: 1111
}
},
handlebars: {
compile: {
options: {
// the namespace within TemplateManager
namespace: "JST",
processName: function(filename) {
// remove the 'src' prefix for the app
return filename.split('/').slice(1).join('/');
}
},
files: {
"src/<%= pkg.bundle %>.jst.min.js": [
"src/app/templates/**/*.html"
]
}
}
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true
},
globals: {
exports: true,
zepto: true,
$: true,
_: true
}
},
compass: {
dev: {
src: 'src/resources/sass',
dest: 'src/resources/css',
outputstyle: 'expanded',
relativeassets: true,
linecomments: true,
// debugsass: true,
images: 'src/resources/images',
fonts: 'src/resources/fonts'
},
prod: {
src: 'src/resources/sass',
dest: 'build/resources/css',
outputstyle: 'compressed',
linecomments: false,
debugsass: false,
forcecompile: false,
relativeassets: true,
images: 'src/resources/images',
fonts: 'src/resources/fonts'
}
},
watch: {
compass: {
files: ['src/resources/sass/**/*.scss'],
tasks: ['compass:dev']
},
handlebars: {
files: [
'src/app/templates/**/*.html'
],
tasks: 'handlebars'
}
},
clean: {
build: [
'build/**'
]
},
copy: {
build: {
files: {
"build/": [
"src/scripts/requirejs/require.js",
"src/config.js",
"src/index.html",
"src/resources/**/*.css",
"src/resources/**/*.png",
"src/resources/**/*.jpg"
]
}
},
dist: {
files: {
}
}
}
});
// grunt.loadNpmTasks('grunt-buster');
grunt.loadNpmTasks('grunt-compass');
grunt.loadNpmTasks('grunt-contrib');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-handlebars');
// Default task.
grunt.registerTask('default', 'clean compass handlebars requirejs copy');
grunt.registerTask('dist', 'clean compass:prod handlebars requirejs copy');
grunt.registerTask('build', 'clean compass handlebars requirejs copy');
};