Skip to content

Commit 351c8da

Browse files
committed
fix: exclude script tags
1 parent e26fa7e commit 351c8da

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@egoistdeveloper/twcss-to-sass",
3-
"version": "2.1.15",
3+
"version": "2.1.16",
44
"description": "HTML template to SASS converter for TailwindCSS",
55
"main": "dist/cjs/index.js",
66
"module": "dist/esm/index.js",

src/twcss-to-sass.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ function filterHtmlData(nodeTree: IHtmlNode[], deepth = 0): IHtmlNode[] {
120120
if (nodeTree.length > 0) {
121121
// we do need to empty or doctype declaration
122122
nodeTree = nodeTree.filter(
123-
(x: IHtmlNode) => x.content !== ' ' && x.tagName != '!doctype'
123+
(x: IHtmlNode) =>
124+
x.content !== ' ' && x.tagName != '!doctype' && x.tagName != 'script'
124125
)
125126

126127
nodeTree.forEach((node: IHtmlNode, index) => {
@@ -696,6 +697,7 @@ export function convertToSass(
696697
htmlTreeResult = ''
697698

698699
if (sassTreeResult) {
700+
// clean peer utility classes
699701
sassTreeResult = sassTreeResult.replace(
700702
/ peer-([a-z0-9]+):([a-z0-9-:\/]+)/gm,
701703
''

0 commit comments

Comments
 (0)