Skip to content

Commit d5a9203

Browse files
authored
Merge pull request #25 from chengpeiquan/develop
feat: Comments are no longer automatically added when the �erify opti…
2 parents 7841a41 + e42603e commit d5a9203

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vite-plugin-banner",
33
"description": "A banner plugin for Vite. Adds a banner to the top of each generated chunk.",
4-
"version": "0.6.1",
4+
"version": "0.7.0",
55
"author": "chengpeiquan <[email protected]>",
66
"license": "MIT",
77
"homepage": "https://github.com/chengpeiquan/vite-plugin-banner",

src/main.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,27 @@ export default function (
6060
let data: string = fs.readFileSync(filePath, {
6161
encoding: 'utf8',
6262
})
63+
6364
let myContent: string =
6465
typeof setContent === 'string' ? setContent : ''
6566
if (typeof setContent === 'function') {
6667
myContent = setContent(fileName)
6768
if (!myContent) return
6869
}
70+
6971
// If the banner content has comment symbol, use it directly
70-
if (myContent.includes('/*') || myContent.includes('*/')) {
72+
if (
73+
myContent.includes('/*') ||
74+
myContent.includes('*/') ||
75+
!pluginConfig.verify
76+
) {
7177
data = `${myContent}\n${data}`
7278
}
7379
// Otherwise add comment symbol
7480
else {
7581
data = `/*! ${myContent} */\n${data}`
7682
}
83+
7784
// Save
7885
fs.writeFileSync(filePath, data)
7986
} catch (e) {

0 commit comments

Comments
 (0)