Skip to content

Commit

Permalink
build: Fix inefficient regular expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Oct 28, 2022
1 parent 6b8b0dc commit 2d9a2a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ function cssMin(attrs) {
.replace(/(.*)\/\*!\s*([\w-]+)\s*([\w-.]*)\s*\*\//g, cmdFn)

// Remove optional spaces and put each rule to separated line
.replace(/(["'])((?:\\?.)*?)\1|[^"']+/g, clearFn)
.replace(/(["'])((?:\\\1|.)*?)\1|[^"']+/g, clearFn)

// Use CSS shorthands
//.replace(/([^0-9])-?0(px|em|%|in|cm|mm|pc|pt|ex)/g, "$10")
Expand Down Expand Up @@ -374,7 +374,7 @@ function cssMin(attrs) {
function tplMin(attrs) {
var out = [""]
//, templateRe = /^([ \t]*)(%?)((?:("|')(?:\\?.)*?\4|[-\w:.#[\]]=?)*)[ \t]*([>^;@|\\\/]|!?=|)(([\])}]?).*?([[({]?))$/gm
, templateRe = /([ \t]*)(%?)((?:("|')(?:\\?.)*?\4|[-\w:.#[\]]=?)*)[ \t]*([>^;@|\\\/]|!?=|)(([\])}]?).*?([[({]?))(?=\x1f|\n|$)+/g
, templateRe = /([ \t]*)(%?)((?:("|')(?:\\\4|.)*?\4|[-\w:.#[\]]=?)*)[ \t]*([>^;@|\\\/]|!?=|)(([\])}]?).*?([[({]?))(?=\x1f|\n|$)+/g
, parent = 0
, stack = [-1]

Expand Down

0 comments on commit 2d9a2a1

Please sign in to comment.