-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathGruntfile.js
96 lines (85 loc) · 2.02 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
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
//Watch for file changes and kicks off a build if needed
watch: {
scripts: {
files: ['Gruntfile.js', 'src/**/*'],
tasks: ['default'],
options: {
interrupt: true,
reload: true
}
}
},
//Cleans the build directory
clean: {
build: ['build']
},
//Copies all src files into the build dir for a new build
copy: {
main: {
files: [{
expand: true,
cwd: 'src/',
src: ['**'],
dest: 'build/'
}]
}
},
//Handles ES2015 syntax conversions
//See: https://babeljs.io/
babel: {
options: {
plugins: ['lodash'],
presets: ['es2015']
},
dist: {
files: [{
expand: true,
cwd: 'build/',
src: ['**/*.js'],
dest: 'build/',
ext: '.js'
}]
}
},
//JS syntax checking
eslint: {
options: {
configFile: '.eslintrc.json'
},
target: {
files: [{
expand: true,
src: [
'build/**/*.js',
'build/**/*.json'
]
}]
},
},
pkg: grunt.file.readJSON('package.json'),
//Generates new API docs using YUI Doc
yuidoc: {
compile: {
name: '<%= pkg.name %>',
description: '<%= pkg.description %>',
version: '<%= pkg.version %>',
url: '<%= pkg.homepage %>',
options: {
paths: './build',
themedir: 'apidocs_theme/default/',
outdir: 'build/apidocs'
}
}
}
});
//Default task(s)
grunt.registerTask('default', ['clean', 'copy', 'babel', 'eslint', 'yuidoc']);
//Task for just generating docs
grunt.registerTask('docs', ['yuidoc']);
//Dev task that monitors for changes and kicks off autobuilds
//Will ultimately run all tasks define in the "default" task
grunt.registerTask('dev', ['watch']);
};