-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
113 lines (103 loc) · 3.51 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
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
codemirror: {
options: {
compress: true,
warnings: false
},
files: {
'build/pub/js/codemirror.js':
['components/codemirror/lib/codemirror.js',
'src/codemirror/dide/dide.js',
'components/codemirror/addon/selection/active-line.js'],
}
},
debug: {
options: {
beautify: true,
mangle: false,
sourceMap: true,
sourceMapIncludeSources : true
},
files: {
'build/pub/js/emu-dide.js': ['src/app/**/*.js']
}
},
release: {
options: {
compress: true
},
files: {
'build/pub/js/emu-dide.js' : ['src/app/**/*.js']
}
}
},
copy: {
resources: {
files: {
'build/pub/js/underscore.js': ['components/underscore/underscore.js'],
'build/pub/js/bootstrap.js': ['components/bootstrap/dist/js/bootstrap.js'],
'build/pub/js/jquery.js': ['components/jquery/dist/jquery.js'],
'build/pub/css/bootstrap.css': ['components/bootstrap/dist/css/bootstrap.css'],
'build/pub/css/codemirror.css' : ['components/codemirror/lib/codemirror.css'],
'build/emu-dide.html': ['src/view/index.html'],
'build/pub/css/emu-dide.css': ['src/view/css/emu-dide.css'],
'build/pub/img/logo.png': ['src/view/img/logo.png'],
'build/pub/img/login-btn-edge.png': ['src/view/img/login-btn-edge.png']
}
},
services: {
cwd: 'src/services',
src: '**/*',
dest: 'build/',
expand: true
},
db: {
files : {
'build/db/emudide.sqlite' : ['misc/emudide.sqlite']
}
},
htaccess: {
files: {
'build/.htaccess' : ['misc/root.htaccess'],
'build/model/.htaccess' : ['misc/forbid.htaccess'],
'build/flight/.htaccess' : ['misc/forbid.htaccess'],
'build/db/.htaccess' : ['misc/forbid.htaccess']
}
}
},
php: {
services: {
options:{
port: 1337,
base: 'build',
hostname: 'localhost',
}
}
},
watch: {
files: ['src/**/*.js', 'src/**/*.html', 'src/**/*.css', 'src/**/*.php'],
tasks: ['jshint:all', 'uglify:debug', 'copy:debug', 'copy:services'],
options : {
livereload: true
}
},
jshint: {
all: ['Gruntfile.js', 'src/**/*.js']
},
clean: ['build']
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-php');
grunt.registerTask('build-debug', ['jshint:all','uglify:debug', 'uglify:codemirror', 'copy:resources', 'copy:services', 'copy:db']);
grunt.registerTask('build', ['jshint:all', 'uglify:release', 'uglify:codemirror', 'copy:resources', 'copy:services', 'copy:db', 'copy:htaccess']);
grunt.registerTask('debug-serve', ['build', 'php:services', 'watch']);
grunt.registerTask('default', ['clean']);
};