This repository has been archived by the owner on Jul 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
103 lines (98 loc) · 3.36 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
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
appDir: 'web/assets',
builtDir: 'web/assets/compiled',
requirejs: {
main: {
options: {
mainConfigFile: '<%= appDir %>/js/common.js',
appDir: '<%= appDir %>',
baseUrl: './js',
dir: '<%= builtDir %>',
optimizeCss: "none",
optimize: "none",
modules: [
{
name: 'common',
include: ['jquery', 'domReady', 'bootstrap']
},
{
name: 'app/main',
exclude: ['common']
},
{
name: 'app/gallery',
exclude: ['common']
}
]
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: [
{
expand: true,
cwd: '<%= builtDir %>',
src: 'js/*.js',
dest: '<%= builtDir %>'
},
{
expand: true,
cwd: '<%= builtDir %>',
src: 'js/app/*.js',
dest: '<%= builtDir %>'
}
]
}
},
jshint: {
options: {
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= appDir %>/js/{,*/}*.js'
]
},
less: {
development: {
files: {
"<%= appDir %>/css/layout.css": "<%= appDir %>/less/layout.less",
"<%= appDir %>/css/homepage.css": "<%= appDir %>/less/homepage.less",
"<%= appDir %>/css/event.css": "<%= appDir %>/less/event.less"
}
},
production: {
options: {
cleancss: true
},
files: {
"<%= builtDir %>/css/layout.css": "<%= appDir %>/less/layout.less",
"<%= builtDir %>/css/homepage.css": "<%= appDir %>/less/homepage.less",
"<%= builtDir %>/css/event.css": "<%= appDir %>/less/event.less"
}
}
},
watch: {
less: {
files: '<%= appDir %>/less/*.less',
tasks: ['less:development'],
options: {
spawn: false
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['jshint', 'less:development']);
grunt.registerTask('production', ['jshint', 'requirejs', 'uglify', 'less:production']);
};