-
Notifications
You must be signed in to change notification settings - Fork 1
/
grunt.js
148 lines (119 loc) · 3.71 KB
/
grunt.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
var connect = require('connect');
var path = require('path');
var fs = require('fs');
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
lint: {
files: ['grunt.js', 'src/**/*.js', 'test/**/*.js']
},
test: {
files: ['test/**/*.js']
},
watch: {
files: '<config:lint.files>',
tasks: 'lint test'
},
jshint: {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true
},
globals: {}
},
compass: {
dev: {
options: {
src: 'src/white-theme.scss',
dest: 'app/style/white.css',
linecomments: true,
forcecompile: true,
debugsass: true,
relativeassets: true
}
}
}
});
grunt.loadTasks('tasks');
// Redefining the "server" task for this project. Note that the output
// displayed by --help will reflect the new task description.
grunt.registerTask('server2', 'Start a custom static web server.', function() {
var rootDir = path.resolve('WebContent');
var done = this.async();
grunt.log.writeln('Starting static web server in ' + rootDir + ' on port 1234');
connect()
.use(connect.static(rootDir))
.listen(1234)
.on('close', done);
});
grunt.registerTask('preparecompass', 'compile sass', function() {
var ignores = ['.gitignore', '.ignore', '.buildignore'];
var extloc = 'app/js/ext-4.1/resources/themes/stylesheets/ext4';
var xcploc = 'app/js/resources/themes/stylesheets/xcp';
grunt.task.helper('copy',
path.resolve(extloc),
path.resolve('src/ext4'),
ignores, function(e) {
if ( e ) {
grunt.log.error( e.stack || e.message );
} else {
grunt.log.ok( path.resolve( extloc) + ' -> ' + path.resolve( 'src/ext4' ) );
}
});
grunt.task.helper('copy',
path.resolve(xcploc),
path.resolve('src/xcp'),
ignores, function(e) {
if ( e ) {
grunt.log.error( e.stack || e.message );
} else {
grunt.log.ok( path.resolve( xcploc ) + ' -> ' + path.resolve( 'src/xcp' ) );
}
});
// fs.linkSync(
// path.resolve('app/js/ext-4.1/resources/themes/stylesheets/ext4'),
// path.resolve('src/ext4'),
// 'junction'
// );
// fs.linkSync(
// path.resolve('app/js/resources/themes/stylesheets/xcp'),
// path.resolve('src/xcp'),
// 'junction'
// );
// var gen = // var rootDir = path.resolve('WebContent');
// var done = this.async();
// grunt.log.writeln('Starting static web server in ' + rootDir + ' on port 1234');
// connect()
// .use(connect.static(rootDir))
// .listen(1234)
// .on('close', done);
});
grunt.registerHelper('mkTarget', function(files, opts) {
// opts = opts || {};
// fs.mkdirSync(path.resolve('../gen'));
// files.forEach(function(f){
// });
// grunt.file.expandFiles(files).forEach(function(f) {
// var md5 = grunt.helper('md5', f),
// renamed = [md5.slice(0, 8), path.basename(f)].join('.');
// grunt.verbose.ok().ok(md5);
// // create the new file
// fs.renameSync(f, path.resolve(path.dirname(f), renamed));
// grunt.log.write(f + ' ').ok(renamed);
// });
});
// Default task.
grunt.registerTask('default', 'preparecompass compass:dev');
// grunt.registerTask('default', 'compass:dev');
//todo - Add Phantom rendering comps
//grunt.registerTask('default', 'lint test compass:dev');
};