-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGruntfile.js
109 lines (97 loc) · 2.4 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
var _ = require('underscore')._;
var RJSConfig = require('./src/config');
module.exports = function(grunt) {
// Add require.js to the paths.
RJSConfig.paths = _.extend(RJSConfig.paths, {
'require-lib': '../node_modules/requirejs/require'
});
// Include EVERY path in the distributable.
RJSConfig.include = [];
_.each(RJSConfig.paths, function(path, key) {
RJSConfig.include.push(key);
});
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
options: {
jshintrc: true,
},
all: {
files: {
src: [
"Gruntfile.js",
"app/**/*.js",
"test/**/*.js"
]
}
}
},
requirejs: {
compile: {
options: _.extend(RJSConfig, {
name: 'config',
out: 'dist/react-complete-me.js',
baseUrl: './src',
generateSourceMaps: true,
optimize: 'uglify2',
optimizeAllPluginResources: true,
preserveLicenseComments: false
})
}
},
mocha: {
options: {
reporter: 'Nyan', // Duh!
run: true
}
},
react: {
dynamic_mappings: {
files: [
{
expand: true,
cwd: "src/app/jsx",
src: ["**/*.jsx"],
dest: "src/app/components",
ext: ".js"
}
]
}
},
sass: {
dist: {
files: [{
expand: true,
cwd: "src/sass",
src: "**/*.scss",
dest: "dist",
ext: ".css"
}]
}
},
watch: {
react: {
files: ["src/app/jsx/**/*.jsx"],
tasks: ["react"]
},
sass: {
files: ["src/sass/**/*.scss"],
tasks: ["sass"]
}
}
});
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-requirejs");
grunt.loadNpmTasks("grunt-mocha");
grunt.loadNpmTasks("grunt-react");
grunt.loadNpmTasks("grunt-contrib-sass");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask("lint", ["jshint"]);
grunt.registerTask("test", "Run Mocha tests.", function() {
// If not --test option is specified, run all tests.
var test_case = grunt.option("test") || "**/*";
grunt.config.set("mocha.browser", ["test/" + test_case + ".html"]);
grunt.task.run("mocha");
});
grunt.registerTask("dist", ["sass", "react", "requirejs"]);
};