-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathGruntfile.js
More file actions
81 lines (79 loc) · 2.8 KB
/
Gruntfile.js
File metadata and controls
81 lines (79 loc) · 2.8 KB
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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-git-describe');
var localpackage = grunt.file.readJSON('package.json');
grunt.initConfig({
gitRevisionSHA: 'master',
gitRevisionDirty: 'clean',
localpackage: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '\n'
},
allJavascripts: {
src: [
'node_modules/clipboard/dist/clipboard.js',
'public/media/js/jquery-1.11.1.js',
'public/media/js/ender.overlay.js',
'public/media/js/shorten.js'
],
dest: 'public/media/js/shorten_concat.js'
}
},
uglify: {
options: {
banner: "/**\n"+
"<%= localpackage.name %> - <%= gitRevisionSHA %><%= gitRevisionDirty %>\n" +
"<%= localpackage.description %>\n" +
"JavaScript minified on <%= grunt.template.today('dddd, mmmm dS, yyyy, h:MM:ss TT') %>\n" +
"**/\n",
//sourceMap: 'dist/js/scripts.map', // make sure these don't hit live
//sourceMapName: 'dist/js/scripts.map'
},
dist: {
files: {
'public/media/shorten.min.js': ['<%= concat.allJavascripts.dest %>']
}
}
},
less: {
development: {
options: {
paths: [""]
},
files: {
"public/media/css/style.css": [ "public/media/css/style.less" ]
}
},
production: {
options: {
paths: [""],
rootpath: "css/",
cleancss: true,
},
files: {
"public/media/shorten.min.css": [ "public/media/css/style.less" ]
}
}
},
"git-describe": {
build: {
options: {
prop: "gitInfo"
}
}
}
});
grunt.registerTask('getGitRevision', function() {
grunt.event.once('git-describe', function (rev) {
grunt.config('gitRevisionSHA', rev.object);
grunt.config('gitRevisionTag', rev.tag);
grunt.config('gitRevisionDirty', rev.dirty);
});
grunt.task.run('git-describe');
});
grunt.registerTask('default', ['getGitRevision', 'concat', 'uglify', 'less']);
grunt.registerTask('live', ['concat', 'uglify', 'less']);
};