Ejemplo n.º 1
0
func main() {
	filename := flag.String("filename", "", "relative path to the less file you would like to convert to scss")
	flag.Parse()
	if *filename != "" {
		ch := converter.LessToSass(*filename)
		sassFile := <-ch
		if sassFile.Err != nil {
			fmt.Println(sassFile.Err)
		}
		writeSassFile(*filename, sassFile.Data)
	} else {
		fmt.Println("-- Converting Project to Sass --")
		err := filepath.Walk("../", inspect)
		fmt.Printf("File path return %v\n", err)
	}
}
Ejemplo n.º 2
0
func inspect(path string, info os.FileInfo, err error) error {
	if err != nil {
		return err
	}
	match, err := filepath.Match("*.less", info.Name())
	if match && err == nil {
		fmt.Printf("Less file found! -> %s\n", info.Name())
		ch := converter.LessToSass(path)
		sassFile := <-ch
		if sassFile.Err != nil {
			fmt.Println(sassFile.Err)
		}
		writeSassFile(path, sassFile.Data)
	}
	if err != nil {
		return err
	}
	return nil
}