Created
February 21, 2023 09:09
-
-
Save tkdn/cb0547c3b469f22436731e11389b9300 to your computer and use it in GitHub Desktop.
tag差し込み
This file contains hidden or 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
import { readFileSync, writeFileSync } from 'node:fs'; | |
const filePath = './dist/index.html'; | |
const org = readFileSync(filePath, { encoding: 'utf-8' }); | |
const injectTag = '<meta foo="baz" />'; | |
const buff = org.replace(/(\<\/head\>)/, `${injectTag}$1`); | |
writeFileSync(filePath, buff); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment