Skip to content

Commit

Permalink
feat: handle extension content
Browse files Browse the repository at this point in the history
  • Loading branch information
shaobeichen committed Sep 17, 2024
1 parent 4262cfc commit c46bd0a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
11 changes: 8 additions & 3 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<style data-gradient-theme-id>@charset "UTF-8";

<style data-gradient-theme-id>
.shaobeichen-gradient-theme-themes-gradient-bearded-theme-arc-json { /* git 待提交数量徽章样式 */
/* 选中标签栏上边框 */
/* html标签属性 */
Expand Down Expand Up @@ -48,7 +49,10 @@
background-image: linear-gradient(45deg, #d0d7e4, #b78aff);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
}</style><style data-gradient-theme-id>@charset "UTF-8";
}
</style>

<style data-gradient-theme-id>
.shaobeichen-gradient-theme-themes-gradient-dracula-theme-json { /* git 待提交数量徽章样式 */
/* 选中标签栏上边框 */
/* html标签属性 */
Expand Down Expand Up @@ -98,4 +102,5 @@
}
.shaobeichen-gradient-theme-themes-gradient-dracula-theme-json .mkt8 {
color: #ffc267;
}</style>
}
</style>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "gradient-theme",
"displayName": "Gradient Theme",
"description": "Multiple beautiful gradient themes",
"version": "1.5.0",
"version": "1.6.0",
"author": "shaobeichen",
"publisher": "shaobeichen",
"icon": "./icon.png",
Expand Down
10 changes: 9 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ const output = config.themes.reduce((prev, cur) => {
const cssText = fs.readFileSync(cssFileUrl, 'utf-8')
const scssText = `.${config.classTemplate.replace('${themeName}', cur)}{${cssText}}`
const scssCompile = sass.compileString(scssText, { sourceMap: false, style: 'expanded' })
return prev + `<style ${config.tagAttr}>${scssCompile.css.toString()}</style>`
const cssWithoutCharset = scssCompile.css.toString().replace(/^@charset "UTF-8";\s*/g, '')
return (
prev +
`
<style ${config.tagAttr}>
${cssWithoutCharset}
</style>
`
)
}, '')

fs.writeFileSync(indexFilePath, output, 'utf-8')
5 changes: 2 additions & 3 deletions src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ function reset() {

function install() {
const distIndexHtmlFile = path.join(__dirname, '../dist/index.html')

const html = getResetContent()
const styleHtml = fs.readFileSync(distIndexHtmlFile, 'utf-8')

fs.writeFileSync(htmlFile, html + styleHtml, 'utf-8')
const output = html.replace('</html>', '') + styleHtml + '</html>'
fs.writeFileSync(htmlFile, output, 'utf-8')

showReloadMessage(enableMessage)
}
Expand Down

0 comments on commit c46bd0a

Please sign in to comment.