-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
91 lines (87 loc) · 2 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
'use strict';
module.exports = function(grunt) {
var BASE_DIR = './';
var SRC_DIR = BASE_DIR + 'src/';
var DIST_DIR = BASE_DIR + 'dist/';
var DEMO_DIR = BASE_DIR + 'demo/';
var ANY_SUB_DIR = '**/';
var ANY_JS_FILE = '*.js';
var ANY_COFFEE_FILE = '*.coffee';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
SRC_DIR + ANY_SUB_DIR + ANY_JS_FILE,
DEMO_DIR + ANY_SUB_DIR + ANY_JS_FILE
],
options: {
jshintrc: '.jshintrc'
}
},
connect: {
serverKeepAlive: {
options: {
keepalive: true,
port: 8003,
hostname: 'localhost'
}
}
},
coffee: {
compile: {
files: [
{
src: [
SRC_DIR + 'CustomSelection.coffee',
SRC_DIR + ANY_SUB_DIR + ANY_COFFEE_FILE
],
dest: DIST_DIR + 'all-coffee.js'
}
]
}
},
clean: {
coffeeBuild: [DIST_DIR + 'all-coffee.js']
},
concat: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
build: {
files: [
{
src: [
DIST_DIR + 'all-coffee.js',
SRC_DIR + ANY_SUB_DIR + ANY_JS_FILE
],
dest: DIST_DIR + 'jquery.custom-selection.js'
}
]
}
},
uglify: {
options: {
sourceMap: true,
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */'
},
build: {
files: [
{
src: [DIST_DIR + 'jquery.custom-selection.js'],
dest: DIST_DIR + 'jquery.custom-selection.min.js'
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.registerTask('dist', ['jshint', 'coffee:compile', 'concat:build', 'uglify:build', 'clean:coffeeBuild']);
grunt.registerTask('server', ['connect:serverKeepAlive']);
};