This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
forked from tildeio/oasis.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
53 lines (39 loc) · 1.64 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
module.exports = function(grunt) {
var path = require('path');
require('matchdep').
filterDev('grunt-*').
filter(function(name){ return name !== 'grunt-cli'; }).
forEach(grunt.loadNpmTasks);
grunt.loadTasks('tasks');
function config(configFileName) {
return require('./configurations/' + configFileName);
}
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
env: process.env,
clean: ["tmp", "dist/*"],
transpile: config('transpile'),
jshint: config('jshint'),
concat: config('concat'),
uglify: config('uglify'),
copy: config('copy'),
shell: config('shell'),
symlink: config('symlink'),
'saucelabs-qunit': config('saucelabs-qunit'),
connect: config('connect'),
watch: config('watch')
});
grunt.registerTask("jst", function () {
grunt.file.expand({ cwd: 'template/' }, '**/*.jst').forEach(function(templatePath) {
var dir = path.dirname(templatePath),
base = path.basename(templatePath, path.extname(templatePath));
grunt.file.mkdir(path.join('tmp', dir));
grunt.file.write(path.join('tmp', dir, base + '.js'), grunt.template.process(grunt.file.read('template/' + templatePath)));
});
});
grunt.registerTask('build', ['jst', 'transpile', 'jshint', 'concat', 'uglify', 'copy', 'symlink']);
grunt.registerTask('default', ['shell:npmInstall', 'build']);
grunt.registerTask('server', ['shell:npmInstall', 'build', 'connect', 'watch']);
grunt.registerTask('test:ci', ['shell:npmInstall', 'build', 'connect', 'saucelabs-qunit']);
grunt.registerTask('test:ie', ['shell:npmInstall', 'build', 'connect', 'saucelabs-qunit:ie']);
};