-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathGruntfile.js
104 lines (101 loc) · 3.21 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
/**
*
* @author Patrick Oladimeji
* @date 7/15/14 17:40:45 PM
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global module */
module.exports = function (grunt) {
"use strict";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
uglify: {
options: {
banner: '/*!<%= pkg.name %><%= grunt.template.today("yyyy-mm-dd")%>*/\n'
},
build: {
src: 'src/client/index.js',
dest: 'dist/<%=pkg.name%>.min.js'
}
},
requirejs: {
compile: {
options: {
baseUrl: "src/client/app",
mainConfigFile: "src/client/index.js",
out: "dist/<%=pkg.name%>.min.js",
name: "../index",
optimize: "none"
}
}
},
copy: {
main: {
files: [
{expand: true, cwd: "src/client", src: "**/*", dest: "build"}
]
}
},
jshint: {
all: ["src/client/app/**/*.js", "src/client/tests/**/*.js", "src/server/**/*.js", "examples/tutorials/**/*.js", "!examples/tutorials/**/styles/**/*.js", "!src/server/lib/**/*.js", "!src/client/tests/lib/**/*.js"],
options: {
jshintrc: true // search for .jshintrc files relative to the files being linted
}
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
"src/client/css/style.css": "src/client/css/scss/style.scss"
}
}
},
postcss: {
options: {
map: {
inline: false // save sourcemaps as separate files
},
processors: [
require('autoprefixer')({browsers: 'last 4 versions'}), // add vendor prefixes
]
},
dist: {
src: 'src/client/css/style.css'
}
},
watch: {
source: {
files: ["src/client/css/scss/**/*.scss", "src/client/css/scss/**/*.css"],
tasks: ["sass", "postcss"]
}
},
run: {
options: {
wait: true
},
server: {
cmd: "./start.sh"
}
},
concurrent: {
dev: ['run:server', 'watch'],
options: {
logConcurrentOutput: true
}
}
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-concurrent");
grunt.loadNpmTasks("grunt-sass");
grunt.loadNpmTasks("grunt-run");
grunt.loadNpmTasks('grunt-postcss');
grunt.registerTask("test", ["jshint:all"]);
grunt.registerTask("default", ["test"]);
grunt.registerTask("dev", ["sass", "postcss", "concurrent:dev"]);
};