Skip to content

Commit

Permalink
Add minifier tool
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Dec 31, 2023
1 parent 59c953c commit 2b64d50
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package main

import (
"os"

"github.com/go-toolsmith/minformat"
)

func main() {
if len(os.Args) != 2 {
panic("needs 1 argument: file to process")
}

filename := os.Args[1]

b, err := os.ReadFile(filename)
if err != nil {
panic(err)
}

res, err := minformat.Source(b)
if err != nil {
panic(err)
}

if err := os.WriteFile("minified.go", res, os.ModePerm); err != nil {
panic(err)
}
}

0 comments on commit 2b64d50

Please sign in to comment.