Skip to content

Instantly share code, notes, and snippets.

@nathakits
Created January 13, 2020 05:47
Show Gist options
  • Save nathakits/de761919ea78f6d5b97367c9041173c9 to your computer and use it in GitHub Desktop.
Save nathakits/de761919ea78f6d5b97367c9041173c9 to your computer and use it in GitHub Desktop.
Used to find matching header in vue files
const fs = require('fs');
const glob = require('glob');
const fileType = 'pages/**/*.vue';
glob(fileType, function (err, files) {
files.forEach(file => {
const data = fs.readFileSync(file, 'utf8');
const matchH1 = data.match(/h1/g);
if (matchH1) {
// console.log('Yes');
} else {
console.log(file);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment