-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with Includes #6
Comments
Hehe, I just saw that there were some other (closed) issues/PRs concerning this. Just close this issue if it's no longer relevant. |
I think it's relevant. Please send a PR with your fix and if you have extra time, write a test for it. Thank you for reporting it! |
No problem. I'll try to look into it tomorrow. |
I forked this and added the single-line change, but so far I didn't have time to write a test (it seems to me that I'll have to include |
@killercup That also fixes the problem where the .raml file gets copied to the gulp.dest folder when it's different from the src. However, I think the this.push(file) isn't called always, because when one of the if-statements is true, there are early returns. This fork fixes that, and also mimics the example gulp plugin. I don't know gulp enough to know if that's a problem, but I think it can't do any harm either. |
@nvh, yes, you are right. I should've seen those early returns ;) You should send this as a PR. |
I'm still having issues with included schemas and resolving paths, any news on a fix? |
I've already created this pull request, but it isn't merged yet |
yep, I can confirm that includes don't work if dest dir != source dir, and also the dest dir is not created if it does not exist used 3-step workaround for now:
var del = require('del');
var path = require('path');
var gulp = require('gulp');
var rename = require('gulp-rename');
var raml2html = require('gulp-raml2html');
var RAML = '../api/api.raml';
var APIDOC = '../server/static/docs/api/index.html';
gulp.task('apidoc', ['apidoc-copy'], function(done) {
del(RAML.replace(/\.raml$/, '.html'), {force: true}, done);
});
gulp.task('apidoc-copy', ['apidoc-html'], function() {
return gulp.src(RAML.replace(/\.raml$/, '.html'))
.pipe(rename(path.basename(APIDOC)))
.pipe(gulp.dest(path.dirname(APIDOC)));
});
gulp.task('apidoc-html', function() {
return gulp.src(RAML)
.pipe(raml2html())
.pipe(gulp.dest(path.dirname(RAML)));
}); |
another workaround is to just use current raml2html directly: |
Hi,
I just wanted to try this out and got some errors concerning missing files for includes.
Gulpfile:
RAML file:
From what I can tell, this is because here the first action of the plugin is pushing the
file
object back into the stream. But when convertFile is later called, the file's path has been changed bygulp.dest
(cf. this).Long story short, I moved the
this.push(file);
line to the end of the function and it seems to work.(Maybe I'll send a pull request later, I just wanted to write this down before I forget.)
The text was updated successfully, but these errors were encountered: