add --no-minify to jorge build

This commit is contained in:
facundoolano 2024-03-14 12:17:37 -03:00
parent 23b6bc4cce
commit ac83d47f71
2 changed files with 2 additions and 1 deletions

View file

@ -17,6 +17,7 @@ const DIR_RWE_MODE = 0777
type Build struct { type Build struct {
ProjectDir string `arg:"" name:"path" optional:"" default:"." help:"Path to the website project to build."` ProjectDir string `arg:"" name:"path" optional:"" default:"." help:"Path to the website project to build."`
NoMinify bool `help:"Disable file minifying."`
} }
// Read the files in src/ render them and copy the result to target/ // Read the files in src/ render them and copy the result to target/
@ -27,6 +28,7 @@ func (cmd *Build) Run(ctx *kong.Context) error {
if err != nil { if err != nil {
return err return err
} }
config.Minify = !cmd.NoMinify
err = site.Build(*config) err = site.Build(*config)
fmt.Printf("done in %.2fs\n", time.Since(start).Seconds()) fmt.Printf("done in %.2fs\n", time.Since(start).Seconds())

View file

@ -26,7 +26,6 @@ func LoadMinifier() Minifier {
return Minifier{minifier} return Minifier{minifier}
} }
// if enabled by config, minify web files
func (m *Minifier) Minify(extension string, contentReader io.Reader) io.Reader { func (m *Minifier) Minify(extension string, contentReader io.Reader) io.Reader {
if !slices.Contains(SUPPORTED_MINIFIERS, extension) { if !slices.Contains(SUPPORTED_MINIFIERS, extension) {