This repository has been archived by the owner on Oct 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntFile.js
119 lines (113 loc) · 3.75 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
/*jslint node: true*/
/*jslint nomen: true*/
/* Grunt File
*
* To Do:
* - Combine JS
* - Minify JS
* - Compile SASS (compass)
* - Minify CSS
* - HTML Minify
* - Copy other assets (images, fonts, etc)
*/
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
htmlmin: {
production: {
options: { // Target options
removeComments: true,
collapseWhitespace: true
},
files: { // Dictionary of files
'dist/index.html': 'public/index.html' // 'destination': 'source'
}
},
dev: { // Another target
files: {
'dist/index.html': 'public/index.html' // 'destination': 'source'
}
}
},
compass: {
dev: { // Another target
options: {
sassDir: 'public/sass',
cssDir: 'dist/css'
}
}
},
watch: {
src: {
files: ['lib/**/*.js',
'public/js/*.js',
'public/sass/*.scss',
'public/**/*.html'],
tasks: ['htmlmin:dev', 'compass', 'uglify:dev']
}
},
concurrent: {
dev: {
tasks: ['watch', 'serve', 'uglify:dev'],
options: {
logConcurrentOutput: true
}
},
production: {
tasks: ['watch', 'serve', 'uglify:production'],
options: {
logConcurrentOutput: true
}
}
},
uglify: {
dev: {
options: {
beautify: true,
mangle: false
},
files: {
'dist/js/library.js': ['public/bower_components/jquery/dist/jquery.js',
'public/bower_components/bootstrap/dist/js/bootstrap.js'],
'dist/js/main.js': ['public/js/main.js']
}
},
production: {
options: {
mangle: false
},
files: {
'dist/js/library.js': ['public/bower_components/jquery/dist/jquery.js',
'public/bower_components/bootstrap/dist/js/bootstrap.js',
'public/js/ga.js'],
'dist/js/main.js': ['public/js/main.js']
}
}
},
concat: {
all: {
src: ['public/bower_components/bootstrap/dist/css/bootstrap.css'],
dest: 'dist/css/library.css'
}
}
});
grunt.registerTask('serve', "Start application", function () {
this.async();
var app = require('./lib');
app.start();
});
/* tasks */
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
/* register commands */
grunt.registerTask('default', ['htmlmin:dev', 'compass', 'concat', 'concurrent:dev']);
grunt.registerTask('prod', ['htmlmin:production', 'compass', 'concat', 'concurrent:production']);
grunt.registerTask('deploy', ['htmlmin:production', 'compass', 'concat', 'uglify:production']);
};