-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
134 lines (122 loc) · 3.17 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
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
// Clean files from dist/ before build
clean: {
css: ["public/dist/*.css", "public/dist/*.css.map"],
js: ["public/dist/*.js", "public/dist/*.js.map"],
fonts: ["public/fonts/**"]
},
// Copy FontAwesome files to the fonts/ directory
copy: {
fonts: {
src: [
'bower_components/font-awesome/fonts/**'
],
dest: 'public/fonts/',
flatten: true,
expand: true
}
},
// Transpile LESS
less: {
options: {
sourceMap: true,
paths: ['bower_components/bootstrap/less']
},
prod: {
options: {
compress: true,
cleancss: true
},
files: {
"public/dist/style.css": "src/css/style.less"
}
}
},
// Run our JavaScript through JSHint
jshint: {
js: {
src: ['src/js/**/*.js']
}
},
// Runs the r.js optimizer
requirejs: {
compile: {
options: {
baseUrl: 'src/js',
mainConfigFile: 'src/js/config.js',
out: 'public/dist/scripts.js',
optimize: 'uglify2',
include: [
'app'
],
name: '../../bower_components/almond/almond',
generateSourceMaps: true,
preserveLicenseComments: false
}
}
},
// Watch for changes in LESS and JavaScript files,
// relint/retranspile when a file changes
watch: {
options: {
livereload: true
},
markup: {
files: ['index.php']
},
scripts: {
files: ['src/js/**/*.js'],
tasks: ['jshint', 'clean:js', 'requirejs']
},
styles: {
files: ['src/css/**.less'],
tasks: ['clean:css', 'less']
},
templates: {
files: ['src/templates/**/*.hbs'],
tasks: ['clean:js', 'handlebars', 'requirejs']
}
},
// Deploy to CMG servers with FTP
ftpush: {
stage: {
auth: {
host: 'host.coxmediagroup.com',
port: 21,
authKey: 'cmg'
},
src: 'public',
dest: '/stage_aas/projects/news/census/estimates-2014',
exclusions: ['dist/tmp','Thumbs.db'],
simple: true,
useList: false
},
prod: {
auth: {
host: 'host.coxmediagroup.com',
port: 21,
authKey: 'cmg'
},
src: 'public',
dest: '/prod_aas/projects/news/census/estimates-2014',
exclusions: ['dist/tmp','Thumbs.db'],
simple: true,
useList: false
}
}
});
// Load the task plugins
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-ftpush');
grunt.registerTask('default', ['jshint', 'clean', 'copy', 'less', 'requirejs']);
grunt.registerTask('stage', ['default','ftpush:stage']);
grunt.registerTask('prod', ['default','ftpush:prod']);
};