all repos — vite @ 678fa38599dd50bf47e04e6440675b8e133b543c

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 %s\n", fp)
22	return nil
23}