mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-16 05:08:03 +08:00
修复测试版本若干问题
This commit is contained in:
@@ -15,12 +15,9 @@ import (
|
||||
"github.com/iwind/TeaGo/files"
|
||||
"github.com/iwind/TeaGo/logs"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
"github.com/tdewolff/minify/v2"
|
||||
"github.com/tdewolff/minify/v2/html"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func Generate() error {
|
||||
@@ -43,18 +40,6 @@ func generateComponentsJSFile() error {
|
||||
webRoot = Tea.Root + "/web/public/js/components/"
|
||||
}
|
||||
var f = files.NewFile(webRoot)
|
||||
var backQuoteRegexp = regexp.MustCompile("(?sU)`.+`")
|
||||
|
||||
var instance = minify.New()
|
||||
instance.Add("text/html", &html.Minifier{
|
||||
KeepComments: false,
|
||||
KeepConditionalComments: false,
|
||||
KeepDefaultAttrVals: true,
|
||||
KeepDocumentTags: true,
|
||||
KeepEndTags: true,
|
||||
KeepQuotes: true,
|
||||
KeepWhitespace: true,
|
||||
})
|
||||
|
||||
f.Range(func(file *files.File) {
|
||||
if !file.IsFile() {
|
||||
@@ -69,17 +54,6 @@ func generateComponentsJSFile() error {
|
||||
return
|
||||
}
|
||||
|
||||
data = backQuoteRegexp.ReplaceAllFunc(data, func(blockData []byte) []byte {
|
||||
var minifiedData = blockData[1 : len(blockData)-1]
|
||||
var minifyErr error
|
||||
minifiedData, minifyErr = instance.Bytes("text/html", minifiedData)
|
||||
if minifyErr == nil {
|
||||
blockData = append([]byte{'`'}, minifiedData...)
|
||||
blockData = append(blockData, '`')
|
||||
}
|
||||
return blockData
|
||||
})
|
||||
|
||||
buffer.Write(data)
|
||||
buffer.Write([]byte{'\n', '\n'})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user