Last active
May 18, 2023 18:30
-
-
Save goofrider/7951b1bd0ef8d1780c7e4c5f3094e94b to your computer and use it in GitHub Desktop.
Regex for Removing YAML Front Matter before processing Jekyll file in Gulp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// taken from https://codepen.io/tech4him1/pen/dNyydZ | |
var replace = require('gulp-replace'); | |
// Regex to recognize YAML Front Matter (at beginning of file, 3 hyphens, than any charecter, including newlines, then 3 hyphens). | |
var YAMLFrontMatter = /^---[.\r\n]*---/; | |
gulp.src('./!(_)**/*.md') | |
.pipe(replace(YAMLFrontMatter, '')) | |
.pipe(gulp.dest('./')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment