-
Notifications
You must be signed in to change notification settings - Fork 27
Example how to compile scss? #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
No comment? :( |
Hi Thomas, The compile method is not implemented yet Thomas Boerger notifications@github.com 於 2015年9月17日 星期四寫道:
|
@c9s I know, already commented that on #80 (comment), because of that I'm asking for an example how the library works for creating a pull request to get the cli tool working. Or is the library overall not able to build css from scss? |
probably #66 #66 (comment) we discussed the interface of the |
There are some tests you can check out: https://github.com/c9s/c6/blob/master/compiler/compact_compiler_test.go |
yes, it's not done yet. |
Yeah, looks like it's really not working yet... I tried to build this: package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"github.com/spf13/cobra"
"github.com/c9s/c6/compiler"
"github.com/c9s/c6/parser"
"github.com/c9s/c6/runtime"
)
func main() {
var rootCmd = &cobra.Command{
Use: "c6",
Short: "C6 is a very fast SASS compatible compiler",
Long: `C6 is a SASS compatible implementation written in Go.`,
Run: func(cmd *cobra.Command, args []string) {
},
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of C6",
Long: `All software has versions. This is C6's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("C6 SASS Compiler v0.1 -- HEAD")
},
}
var compileCmd = &cobra.Command{
Use: "compile <input> <output>",
Short: "Compile some SCSS files",
Long: `Compile SCSS files into CSS files`,
Run: func(cmd *cobra.Command, args []string) {
if len(args) != 2 {
log.Fatalf("Please provide input and output paths")
}
input := args[0]
output := args[1]
if _, err := os.Stat(input); os.IsNotExist(err) {
log.Fatalf("Input file does not exist or is unreadable")
}
path := filepath.Dir(output)
if _, err := os.Stat(path); os.IsNotExist(err) {
log.Fatalf("Output dir does not exist or is unreadable")
}
context := runtime.NewContext()
parser := parser.NewParser(context)
compile := compiler.NewCompactCompiler(context)
f, err := os.OpenFile(
output,
os.O_CREATE|os.O_RDWR|os.O_TRUNC,
0660)
defer f.Close()
if err != nil {
log.Fatalf("Failed to open output file for writing")
}
source, err := ioutil.ReadFile(input)
if err != nil {
log.Fatalf("Failed to read source from input file")
}
stmts := parser.ParseScss(string(source[:]))
result := compile.CompileString(stmts)
fmt.Println(result)
},
}
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(compileCmd)
rootCmd.Execute()
} |
Sad, still no progress? I wish we have a scss and coffeescript compiler in golang :( |
Too busy to work on this, I have to earn money, sorry. |
Closed as there seem to be no activity anymore. |
Can you provide a simple example how to compile scss? Than I can create a PR for the cli tool.
The text was updated successfully, but these errors were encountered: