forked from Esri/dojo-bootstrap-map-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgruntfile.js
156 lines (145 loc) · 4.27 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*global module:false*/
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect['static'](require('path').resolve(dir));
};
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
options: {
jshintrc: true
},
all: ['src/app/**/*.js']
},
connect: {
options: {
port:9000,
// change this to '0.0.0.0' to access the server from outside
hostname: 'localhost'
},
// load cdn code w/ livereload
cdn: {
options: {
base: 'src'
}
},
// load built app
build: {
options: {
base: 'dist'
}
}
},
//Open default browser at the app
open: {
cdn: {
path: 'http://localhost:<%= connect.options.port %>/'
},
build: {
path: 'http://localhost:<%= connect.options.port %>/'
}
},
//setup watch tasks
watch: {
options: {
nospan: true,
livereload: LIVERELOAD_PORT
},
source: {
files: ['./src/js/**/*.js'],
tasks: ['jshint']
},
livereload:{
options: {
livereload:LIVERELOAD_PORT
},
files:[
'./src/js/**/*.js',
'./src/**/*.html',
'./src/css/**/*.css'
]
}
},
esri_slurp: {
options: {
version: '3.13'
},
dev: {
options: {
beautify: false
},
dest: 'src/esri'
}
},
// clean the output directory before each build
clean: {
build: ['dist'],
deploy: ['dist/**/*.consoleStripped.js','dist/**/*.uncompressed.js','dist/**/*.js.map'],
bower: ['src/bootstrap-map-js', 'src/dijit', 'src/dojo', 'src/dgrid', 'src/dojo-bootstrap', 'src/dojox', 'src/put-selector', 'src/util', 'src/xstyle'],
slurp: ['src/esri']
},
// dojo build configuration, mainly taken from dojo boilerplate
dojo: {
dist: {
options: {
profile: 'profiles/app.profile.js' // Profile for build
}
},
options: {
dojo: 'src/dojo/dojo.js', // Path to dojo.js file in dojo source
load: 'build', // Optional: Utility to bootstrap (Default: 'build')
// profiles: [], // Optional: Array of Profiles for build
// appConfigFile: '', // Optional: Config file for dojox/app
// package: '', // Optional: Location to search package.json (Default: nothing)
// packages: [], // Optional: Array of locations of package.json (Default: nothing)
// require: '', // Optional: Module to require for the build (Default: nothing)
// requires: [], // Optional: Array of modules to require for the build (Default: nothing)
releaseDir: '../dist', // Optional: release dir rel to basePath (Default: 'release')
cwd: './', // Directory to execute build within
// dojoConfig: '', // Optional: Location of dojoConfig (Default: null),
// Optional: Base Path to pass at the command line
// Takes precedence over other basePaths
// Default: null
basePath: './src'
}
},
processhtml: {
build: {
files: {
'dist/index.html': ['src/index.html']
}
}
},
'gh-pages': {
options: {
base: 'src'
},
src: ['app/**', 'index.html']
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-open');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-esri-slurp');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-dojo');
grunt.loadNpmTasks('grunt-processhtml');
grunt.registerTask('default', ['serve']);
grunt.registerTask('serve', function (target) {
var trgt = target || 'cdn';
grunt.task.run([
'jshint',
'connect:' + trgt,
'open:' + trgt,
'watch'
]);
});
grunt.registerTask('hint', ['jshint']);
grunt.registerTask('slurp', ['clean:slurp', 'esri_slurp:dev']);
grunt.registerTask('build', ['jshint', 'clean:build', 'dojo', 'processhtml']);
grunt.registerTask('deploy', ['gh-pages']);
};