internal/phpx: Decrease server code size
This commit is contained in:
parent
bcd1805001
commit
e4a46658ae
2 changed files with 26 additions and 22 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
|
@ -233,6 +234,8 @@ var serverPHP string
|
|||
|
||||
// pre-process the server.php code to make it shorter
|
||||
func init() {
|
||||
minifier := regexp.MustCompile(`\s*([=)(.,{}])\s*`)
|
||||
|
||||
// remove the first '<?php' line
|
||||
lines := strings.Split(serverPHP, "\n")[1:]
|
||||
for i, line := range lines {
|
||||
|
|
@ -244,5 +247,5 @@ func init() {
|
|||
return !strings.HasPrefix(line, "//")
|
||||
})
|
||||
|
||||
serverPHP = strings.Join(lines, "")
|
||||
serverPHP = minifier.ReplaceAllString(strings.Join(lines, ""), "$1")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue