-
Notifications
You must be signed in to change notification settings - Fork 27
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
Does it really work ? #85
Comments
It's really sad that there is absolutely zero useful documentation on a project with 392 stars. Every not-closed issue is from c9s and there are multiple closed issues asking how to use this, without answers. I tried to work something out from the parser tests: package main
import (
"fmt"
"github.com/c9s/c6/parser"
"github.com/c9s/c6/runtime"
)
func main() {
p := parser.NewParser(runtime.NewContext())
stmtList, err := p.ParseScssFile("main.scss")
if err != nil {
fmt.Println(err)
} else {
// ?
}
} However |
Does someone want to take the follow up ? |
package main
import (
"fmt"
"github.com/c9s/c6/parser"
"github.com/c9s/c6/runtime"
"github.com/c9s/c6/compiler"
)
func main() {
context := runtime.NewContext()
parser := parser.NewParser()
stmts, err := p.ParseScssFile("main.scss")
if err != nil {
log.Fatal(err)
}
compiler := compiler.NewCompactCompiler(context)
out := compiler.CompileString(stmts)
ioutil.WriteFile("main.css", []byte(out), 0644)
} See https://github.com/c9s/c6/blob/master/compiler/compact_compiler_test.go#L8 |
@char101 thank you for your example. I modified it to have something which compiles, that gives: package main
import (
// "fmt" <--- `fmt` package is not used
"io/ioutil" // <--- `io/ioutil` package is missing
"log" // <--- `log` package is missing
"github.com/c9s/c6/compiler"
"github.com/c9s/c6/parser"
"github.com/c9s/c6/runtime"
)
func main() {
context := runtime.NewContext()
// parser := parser.NewParser() <--- `parser.NewParser()` method asks `context` argument
parser := parser.NewParser(context)
// stmts, err := p.ParseScssFile("main.scss") <--- I suppose p == parser
stmts, err := parser.ParseScssFile("main.scss")
if err != nil {
log.Fatal(err)
}
compiler := compiler.NewCompactCompiler(context)
out := compiler.CompileString(stmts)
ioutil.WriteFile("main.css", []byte(out), 0644)
} Then, i tried the example on this SCSS file: /*-----------------------------------------
Colors
----------------------------------------- */
$bordercolor: #ccc;
$iconcolor: #6a737b;
$textcolor: #444;
$background: white;
$itembackground: #e6e7e8;
/*-----------------------------------------
Magic Search bar
----------------------------------------- */
.search-bar {
position: relative;
border: 1px solid $bordercolor;
background-color: $background;
margin-bottom: 0.5rem;
padding: 0.25rem;
height: auto;
i.fi-filter {
color: $iconcolor;
position: absolute;
top: 0.35rem;
left: 0.65rem;
}
.search-main-area {
position: relative;
margin-left: 1.65rem;
margin-right: 1.65rem;
cursor: text;
}
.search-selected {
position: relative;
padding-left: 0;
padding-right: 0;
background-color: $background;
color: $textcolor;
}
.search-entry {
position: relative;
display: inline-block;
height: 1.5rem;
height: 1.5rem;
}
.search-input {
width: 17.5rem;
border: 0;
box-shadow: none;
height: 1.5rem;
padding: 0.25rem;
margin-bottom: 0;
background-color: $background;
&:focus {
box-shadow: none;
background-color: $background;
}
}
.match {
font-weight: bold;
}
i.cancel {
color: $iconcolor;
&:hover {
color: darkred;
}
position: absolute;
top: 0.35rem;
right: 0.65rem;
}
.f-dropdown.open {
left: 0 !important;
}
} But the produced file |
Sorry, I didn't tried the code before, I only copy pasted it from the test source code. I have checked it out and it looks like that this compiler is not ready get. I found at least two problems
Maybe you can use this project instead: go-libass. |
I think so. What really a pity ! Currently, Libsass is the best alternative. But a project like |
First, Bravo for making this project.
I tried to use it but no result done. So, i looked at the code and in
cmd/c6
, the function that codes compile command is empty, just createruntime.Context
but the result is assigned to the empty variable (_
).Therefore i suppose that
cmd/c6
is not the goodmain
package. And the README.md doesn't explain how to make the project.I saw an Ant project file (build.xml) but again nothing did, an executable
go_env
doesn't exist. Exceptcmd/c6
, i cannot find any othermain
package.How can i build the binary to execute ?
The text was updated successfully, but these errors were encountered: