forked from danielfdsilva/personal-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
159 lines (138 loc) · 3.65 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
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
154
155
156
157
158
159
module.exports = function(grunt) {
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
grunt.initConfig({
// https://github.com/gruntjs/grunt-contrib-clean
clean : ['app/assets/styles/*', '!app/assets/**/.gitkeep', 'app/assets/scripts/*'],
// https://github.com/gruntjs/grunt-contrib-compass
compass : {
// Default options.
options : {
sassDir : 'source_assets/styles',
cssDir : 'app/assets/styles'
},
dev : {
options : {
environment: 'development',
outputStyle: 'expanded',
debugInfo : true
}
},
prod : {
options : {
environment: 'production',
outputStyle: 'compressed',
}
}
},
// https://github.com/gruntjs/grunt-contrib-jshint
jshint: {
// Default options.
options : {
unused : true
},
dev : {
options : {
force : true
},
src : ['source_assets/scripts/**.js']
},
prod: ['source_assets/scripts/**.js']
},
// https://github.com/gruntjs/grunt-contrib-uglify
uglify: {
options: {
sourceMap: true
},
deps: {
options: {
mangle: false,
sourceMap: false
},
},
main: {
files: {
'./app/assets/scripts/main.min.js': [
'source_assets/angular/**/**.js',
'source_assets/scripts/**.js',
]
},
}
},
// https://github.com/gruntjs/grunt-contrib-copy
/*copy: {
angulartpl: {
files: [
{expand: true, cwd: 'source_assets/angular/templates/', src: '*', dest: 'assets/templates/'}
]
}
},*/
// https://github.com/joeytrapp/grunt-focus
focus: {
main: {
include: ['css', 'js']
}
},
// https://npmjs.org/package/grunt-contrib-watch
watch : {
css: {
files: ['source_assets/styles/**.scss'],
tasks: ['css'],
options: {
livereload: true,
},
},
js: {
files: ['source_assets/scripts/**.js'],
tasks: ['js'],
options: {
livereload: true,
},
}
},
// https://github.com/gruntjs/grunt-contrib-connect
connect: {
options: {
port: 3000,
livereload: 35729,
// Change this to '0.0.0.0' to access the server from outside
hostname: '0.0.0.0',
base: 'app'
},
livereload: {
options: {
open: true,
}
},
server: {
options: {
open: true,
livereload: false,
keepalive: true
}
}
}
});
/////////////////////////////////////
// Load tasks.
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-focus');
/////////////////////////////////////
// Register tasks.
grunt.registerTask('css', ['compass:dev']);
grunt.registerTask('js', ['jshint:dev', 'uglify:main']);
// Aggregate tasks.
grunt.registerTask('build', ['css', 'js']);
grunt.registerTask('serve', ['connect:server']);
// Default task with watch.
grunt.registerTask('default', ['build', 'connect:livereload', 'focus:main']);
// Prod task.
grunt.registerTask('prod', ['clean', 'compass:prod', 'jshint:prod', 'uglify:main']);
};