mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-27 23:04:05 -06:00
feat(configuration): add .gitignore patterns to ignorePatterns
This commit is contained in:
parent
992ac00f7c
commit
ea7b6c6bde
@ -1,5 +1,6 @@
|
|||||||
import { QuartzConfig } from "./quartz/cfg"
|
import { QuartzConfig } from "./quartz/cfg"
|
||||||
import * as Plugin from "./quartz/plugins"
|
import * as Plugin from "./quartz/plugins"
|
||||||
|
import loadIgnorePatterns from "./quartz/util/loadIgnorePatterns"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quartz 4.0 Configuration
|
* Quartz 4.0 Configuration
|
||||||
@ -17,7 +18,7 @@ const config: QuartzConfig = {
|
|||||||
},
|
},
|
||||||
locale: "en-US",
|
locale: "en-US",
|
||||||
baseUrl: "quartz.jzhao.xyz",
|
baseUrl: "quartz.jzhao.xyz",
|
||||||
ignorePatterns: ["private", "templates", ".obsidian"],
|
ignorePatterns: ["private", "templates", ".obsidian", ...loadIgnorePatterns()],
|
||||||
defaultDateType: "created",
|
defaultDateType: "created",
|
||||||
generateSocialImages: false,
|
generateSocialImages: false,
|
||||||
theme: {
|
theme: {
|
||||||
|
|||||||
18
quartz/util/loadIgnorePatterns.ts
Normal file
18
quartz/util/loadIgnorePatterns.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
function loadIgnorePatterns(): string[] {
|
||||||
|
const gitignorePath = path.join(process.cwd(), '.gitignore');
|
||||||
|
if (!fs.existsSync(gitignorePath)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
const gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8');
|
||||||
|
return gitignoreContent
|
||||||
|
.split('\n')
|
||||||
|
.map((line) => line.trim())
|
||||||
|
.filter((line) => line !== '' && !line.startsWith('#'));
|
||||||
|
}
|
||||||
|
|
||||||
|
export default loadIgnorePatterns;
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user