This repository has been archived by the owner on Aug 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Gruntfile.js
101 lines (98 loc) · 2.9 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
module.exports = function(grunt) {
// JS eslint targets
var lint = {
targets: [
'src/**/*.js'
]
};
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
localConfig: (function() {
try {
return grunt.file.readJSON('localConfig.json');
} catch (e) {
return {};
}
})(),
clean: {
buildProducts: 'build/'
},
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 3000,
base: '.'
}
}
},
watch: {
files: [
'src/**/*',
'examples/**/*'
],
tasks: ['build']
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/scooch.js',
dest: 'build/scooch.min.js'
}
},
cssmin: {
core: {
src: 'src/scooch.css',
dest: 'build/scooch.min.css'
},
style: {
src: 'src/scooch-style.css',
dest: 'build/scooch-style.min.css'
}
},
zip: {
'build/scooch.zip': ['src/scooch.js', 'src/scooch.css', 'src/scooch-style.css']
},
eslint: {
prod: {
src: lint.targets,
options: {
reset: true,
config: require.resolve('mobify-code-style/javascript/.eslintrc-prod')
}
},
dev: {
src: lint.targets,
options: {
reset: true,
config: require.resolve('mobify-code-style/javascript/.eslintrc')
}
}
},
open: {
examples: {
path: 'http://localhost:3000/examples',
app: 'Google Chrome'
}
}
});
// Load the task plugins
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-css');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-zip');
grunt.loadNpmTasks('grunt-clean');
// Default task(s).
grunt.registerTask('examples', ['build', 'connect:server', 'open:examples', 'watch']);
grunt.registerTask('lint', ['eslint:prod']);
grunt.registerTask('serve', ['connect', 'watch']);
grunt.registerTask('build', ['lint', 'uglify', 'cssmin', 'zip']);
grunt.registerTask('default', 'build');
};