-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
69 lines (66 loc) · 2.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
module.exports = function(grunt) {
// https://github.com/sindresorhus/load-grunt-tasks
//require('load-grunt-tasks')(grunt);
//
// TODO
// - Think about concatenating & copying CSS & JS from bower_components
// - Think about adding a banner to JS/CSS files while doing that
// |-> Then the asset_bunlder would just compress and hash
// - Use package.json properties (where sensible) in here
//
// - Really, I should probably limit Grunt use to purely development & testing
// and maybe deployment (TBD)
//
// - The rest I should put into a Ruby-based asset pipeline (compiling, compressing, etc.)
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-jshint'); // Local dev only
grunt.loadNpmTasks('grunt-jsbeautifier'); // Ditto
grunt.loadNpmTasks('grunt-contrib-uglify'); // Ditto
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Less task
less: {
options: {},
development: {
files: [{
expand: true,
cwd: 'ui/less/',
//src: ['**/*.less'],
src: ['styles.less'],
dest: 'ui/css/',
ext: '.css',
report: 'min'
}]
},
production: {}
},
// JSHint task
jshint: {
options: {
force: true
},
all: ['ui/js/widget.js', 'ui/js/recentstories.js']
},
jsbeautifier: {
files: ['ui/js/widget.js', 'ui/js/recentstories.js']
},
uglify: {
development: {
files: {
'ui/js/widget.min.js': ['ui/js/widget.js'],
'ui/js/recentstories.min.js': ['ui/js/recentstories.js']
}
}
}
});
// Default task(s).
grunt.registerTask('default', ['deploy']);
grunt.registerTask('deploy', function(target) {
grunt.task.run([
'less:development',
'jshint',
'jsbeautifier',
'uglify:development'
]);
});
};