Added css minify

This commit is contained in:
2026-06-13 04:00:52 +08:00
parent 55541a5930
commit 803bd80557
10 changed files with 259 additions and 142 deletions
+31
View File
@@ -0,0 +1,31 @@
package closure
import (
"context"
"fmt"
"github.com/tgckpg/resolver-go/internal/compilecache"
)
type Compiler struct {
client *Client
}
func NewCompiler() *Compiler {
return &Compiler{client: NewClientFromEnv()}
}
func (c *Compiler) Compile(ctx context.Context, job compilecache.Job) ([]byte, error) {
payload, ok := job.Payload.(CompilePayload)
if !ok {
return nil, fmt.Errorf("closure compiler got invalid payload type %T", job.Payload)
}
req := CompileRequest{
ExternSources: payload.ExternSources,
JSSources: payload.JSSources,
Defines: payload.Defines,
}
return c.client.Compile(ctx, req)
}