forked from Botanical/BotanJS
Added css minify
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user