Skip to content

Commit cfa4ce1

Browse files
committed
chore(grunt): update paths + spawn win issue
1 parent 3547e9b commit cfa4ce1

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

Gruntfile.js

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
'use strict';
22

3+
var sdfs = require('./src/file');
4+
var spawn = require('win-spawn');
5+
var chalk = require('chalk');
6+
37
module.exports = function (grunt) {
48

59
// Load all grunt tasks matching the `grunt-*` pattern.
@@ -8,17 +12,13 @@ module.exports = function (grunt) {
812
// Time how long tasks take.
913
require('time-grunt')(grunt);
1014

11-
// Require SassDoc file utils.
12-
var sdfs = require('./src/file');
13-
1415
// Project specific paths.
1516
var dirs = {
16-
cwd: '.',
17-
base: 'examples/dist', // Server base.
18-
dist: 'examples/dist',
17+
cwd: __dirname,
1918
scss: 'view/scss',
2019
css: 'view/assets/css',
2120
tpl: 'view/templates',
21+
dist: 'examples/dist',
2222
src: 'src',
2323
test: 'src/annotation/annotations/test'
2424
};
@@ -34,7 +34,7 @@ module.exports = function (grunt) {
3434
options: {
3535
style: 'compressed'
3636
},
37-
view: {
37+
dist: {
3838
files: [{
3939
expand: true,
4040
cwd: '<%= dirs.scss %>',
@@ -67,7 +67,7 @@ module.exports = function (grunt) {
6767
watch: {
6868
scss: {
6969
files: ['<%= dirs.scss %>/**/*.scss'],
70-
tasks: ['sass:view']
70+
tasks: ['sass:dist']
7171
},
7272
tpl: {
7373
files: ['<%= dirs.tpl %>/**/*.swig'],
@@ -87,7 +87,7 @@ module.exports = function (grunt) {
8787
options: {
8888
watchTask: true,
8989
server: {
90-
baseDir: '<%= dirs.base %>'
90+
baseDir: '<%= dirs.dist %>'
9191
}
9292
}
9393
}
@@ -100,20 +100,22 @@ module.exports = function (grunt) {
100100
grunt.registerTask('compile', 'Generates documentation', function () {
101101
var done = this.async();
102102

103-
grunt.util.spawn({
104-
cmd: 'bin/sassdoc',
105-
args: ['view/scss/utils', 'examples/dist', '--verbose']
106-
},
103+
// Temporary fix for #73
104+
var src = dirs.scss + '/utils';
105+
var args = [src, dirs.dist, '--verbose'];
107106

108-
function (error, result) {
109-
if (error) {
110-
grunt.log.error(error);
111-
}
107+
var cp = spawn('./bin/sassdoc', args, {stdio: 'inherit'});
108+
109+
cp.on('error', function (err) {
110+
grunt.warn(err);
111+
});
112112

113-
if (result) {
114-
grunt.log.writeln(result);
113+
cp.on('close', function (code) {
114+
if (code > 0) {
115+
return grunt.warn('Exited with error code ' + code);
115116
}
116117

118+
grunt.log.writeln('File ' + chalk.cyan(dirs.dist) + ' created.');
117119
done();
118120
});
119121
});
@@ -126,7 +128,7 @@ module.exports = function (grunt) {
126128
}
127129
});
128130

129-
// While working on the view.
131+
// While working on the view/examples.
130132
grunt.registerTask('dist', [
131133
'browserSync:dist',
132134
'watch'

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@
4141
},
4242
"devDependencies": {
4343
"assert": "^1.1.1",
44+
"chalk": "^0.5.0",
4445
"grunt": "^0.4.5",
4546
"grunt-browser-sync": "^1.1.2",
4647
"grunt-contrib-jshint": "^0.10.0",
4748
"grunt-contrib-sass": "^0.7.3",
4849
"grunt-contrib-watch": "^0.6.1",
4950
"grunt-mocha-test": "^0.11.0",
5051
"load-grunt-tasks": "^0.6.0",
51-
"time-grunt": "^0.3.2"
52+
"time-grunt": "^0.3.2",
53+
"win-spawn": "^2.0.0"
5254
},
5355
"scripts": {
5456
"test": "grunt test"

0 commit comments

Comments
 (0)