Skip to content

Commit

Permalink
Colorized display of md->html paths
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Mar 8, 2022
1 parent caf05e1 commit 2bef032
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
23 changes: 16 additions & 7 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// Imports
import browserSync from 'browser-sync';
import chalk from 'chalk';
import cleanCss from 'gulp-clean-css';
import concat from 'gulp-concat';
import ejs from 'gulp-ejs';
Expand Down Expand Up @@ -82,6 +83,10 @@ const getPageData = () => {
};
return getPageData;
};
const showPaths = () => {
console.log('Source input (markdown):', chalk.green(path.resolve('source')));
console.log('Build output (HTML): ', chalk.white(path.resolve('build')));
};

// Tasks
const task = {
Expand Down Expand Up @@ -142,11 +147,11 @@ const task = {
return task.build();
},
runServer: () => {
gulp.watch('source/*.html', gulp.parallel('build-html'));
gulp.watch('source/includes/**/*', gulp.parallel('build-html'));
gulp.watch('source/js/**/*', gulp.parallel('build-js'));
gulp.watch('source/css/**/*', gulp.parallel('build-css'));
gulp.watch('source/index.yml', gulp.parallel('build-highlightjs', 'build-js', 'build-html'));
gulp.watch('source/*.html', gulp.parallel('build-html'));
gulp.watch('source/includes/**/*', gulp.parallel('build-html'));
gulp.watch('source/js/**/*', gulp.parallel('build-js'));
gulp.watch('source/css/**/*', gulp.parallel('build-css'));
gulp.watch('source/index.yml', gulp.parallel('build-highlightjs', 'build-js', 'build-html'));
const server = browserSync.create();
server.init({
open: true,
Expand All @@ -157,8 +162,11 @@ const task = {
startPath: 'build',
});
gulp.watch('build/**/*').on('change', server.reload);
console.log('Slate markdown source:');
console.log(path.resolve('source'));
showPaths();
},
showPaths: () => {
showPaths();
return gulp.src('source/*.html');
},
publishToDocs: () => {
// mkdirSync('docs');
Expand All @@ -177,4 +185,5 @@ gulp.task('build-highlightjs', task.addHighlightStyle);
gulp.task('build-static-site', task.build);
gulp.task('build-uncompressed', task.buildUncompressed);
gulp.task('serve', task.runServer);
gulp.task('show-paths', task.showPaths);
gulp.task('publish', task.publishToDocs);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
"start": " gulp serve",
"prebuild": " rimraf build **/.DS_Store",
"build": " gulp build-static-site",
"postbuild": "gulp lint && w3c-html-validator build/index.html && gulp publish",
"postbuild": "gulp lint && w3c-html-validator build && gulp show-paths",
"deploy": " deploy.sh"
},
"dependencies": {
"browser-sync": "~2.27",
"chalk": "~5.0",
"fuse.js": "~6.5",
"gulp": "~4.0",
"gulp-clean-css": "~4.3",
Expand Down
1 change: 1 addition & 0 deletions task-runner.sh.command
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ runTasks() {
echo "Tasks:"
npm test
npm run build
npx gulp publish
echo
}

Expand Down

0 comments on commit 2bef032

Please sign in to comment.