-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathghPages.js
34 lines (30 loc) · 966 Bytes
/
ghPages.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const replace = require('replace-in-file')
const fs = require('fs')
/* This file is needed because Github Pages ignores all files and folders prefixed by an underscore (like _next), as documented here: https://github.com/blog/572-bypassing-jekyll-on-github-pages */
fs.writeFile('./docs/.nojekyll')
const adaptStaticPathsInHtml = async () => {
try {
const changes = await replace({
files: './docs/**/*.html',
from: /\"\/static/g,
to: '"/cv/static'
})
console.log('Modified files:', changes.join(', '))
} catch (error) {
console.error('Error occurred:', error)
}
}
const adaptStaticPathsInCss = async () => {
try {
const changes = await replace({
files: './docs/**/*.css',
from: /url\(\/static/g,
to: 'url(/cv/static'
})
console.log('Modified files:', changes.join(', '))
} catch (error) {
console.error('Error occurred:', error)
}
}
adaptStaticPathsInHtml()
adaptStaticPathsInCss()