This repository has been archived by the owner on May 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathGruntfile.js
93 lines (85 loc) · 1.95 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
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: './public/js/vendors/',
layout: 'byComponent',
install: true,
verbose: true,
cleanTargetDir: true,
cleanBowerDir: true
}
}
},
less: {
default: {
files: {
'public/css/main.css': 'less/main.less'
},
options: {
paths: [ 'less/basics', 'less/pages', 'less/parts' ]
}
}
},
requirejs: {
compile: {
options: {
appDir: './public/js',
dir: './public/js/build',
baseUrl: './',
preserveLicenseComments: false,
optimizeCss: 'none',
useStrict: true,
generateSourceMaps: true,
optimize: 'uglify2',
mainConfigFile: "./public/js/require.config.js",
paths: {
'socket.io': 'empty:'
},
modules: grunt.file.expand('./public/js/modules/*').map(function (entry) {
return {
name: entry.replace('./public/js/', '') + '/main'
}
})
}
}
},
autoprefixer: {
options: {
browsers: ['last 5 versions', '> 1%', 'ie 8', 'ie 7']
},
dist: {
files: {
'public/css/main.css': 'public/css/main.css'
}
}
},
cssmin: {
default: {
options: {
report: 'min'
},
files: {
'public/css/main.css': ['public/css/main.css']
}
}
},
watch: {
files: 'less/**/*.less',
tasks: ['build']
}
})
grunt.loadNpmTasks('grunt-autoprefixer');
grunt.loadNpmTasks('grunt-bower-task');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['build']);
grunt.registerTask('build', ['less', 'autoprefixer']);
grunt.registerTask('build:prod', ['less', 'autoprefixer', 'cssmin', 'requirejs']);
grunt.registerTask('update', ['bower', 'build:prod']);
grunt.registerTask('heroku:production', ['update']);
};