I was following this step by step , and then there was a need for the markdown files converted to html to be in another folder.
See the code for the file gulpfile.js
:
var gulp = require('gulp');
var markdown = require('gulp-markdown-it');
gulp.task('markdown', function() {
return gulp.src('**/*.md')
.pipe(markdown())
.pipe(gulp.dest(function(f) {
return f.base;
}));
});
gulp.task('default', ['markdown'], function() {
gulp.watch('**/*.md', ['markdown']);
});
Consider the following project structure:
meuProjeto |_ .vscode | |_ tasks.json |_ folder1 | |_ fileA.md |_ node_modules |_ gulpfile.js |_ package-lock.json |_ sample.md
When I put the task to execute, after some change in the .md
files, I get the following result:
meuProjeto |_ .vscode | |_ tasks.json |_ folder1 | |_ fileA.html | |_ fileA.md |_ node_modules |_ gulpfile.js |_ package-lock.json |_ sample.html |_ sample.md
Note that the .html
files are together with the original .md
files. My goal is to separate them as follows into a build
folder:
meuProjeto |_ .vscode | |_ tasks.json |_ build | |_sample.html | |_ folder1 | |_ fileA.html |_ folder1 | |_ fileA.md |_ node_modules |_ gulpfile.js |_ package-lock.json |_ sample.md
It would be great if the folders were created automatically.
I tried to change the Gulp task code, but I did not succeed. Is it really possible to do what I want?