all repos — vite @ 36426bd1e020a74b014fdda6291e049ad9ed8b8a

a fast (this time, actually) and minimal static site generator

commands/init.go (view raw)

 1package commands
 2
 3import (
 4	"fmt"
 5	"os"
 6	"path/filepath"
 7)
 8
 9func Init(path string) error {
10	paths := []string{"build", "pages", "static", "templates"}
11	var dirPath string
12
13	for _, p := range paths {
14		dirPath = filepath.Join(path, p)
15		err := os.MkdirAll(dirPath, 0755)
16		if err != nil {
17			return err
18		}
19	}
20	fp, _ := filepath.Abs(path)
21	fmt.Printf("vite: created project at %q\n", fp)
22	return nil
23}