Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ _testmain.go

*.exe
*.test
gcss

test/*.css
cmd/gcss/test/*.css
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,15 @@ or
$ cat /path/to/gcss/file | gcss > /path/to/css/file
```

## Compile from Go programs
## Compile command locally

You can compile a GCSS file from Go programs by invoking the `gcss.CompileFile` function.
You can compile the command on the local system with the following:

```$ go build -o gcss cmd/gcss/main.go```

## Compile/translate from Go programs

You can compile/translate a GCSS file from Go programs by invoking the `gcss.CompileFile` function.

```go
cssPath, err := gcss.CompileFile("path_to_gcss_file")
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/yosssi/gcss

go 1.22.0
36 changes: 36 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env zsh

# This script is primarily to document the development lifecycles of the app.
# Call ./run.sh -b to build the application
# Call ./run.sh -e for an example call
# Use ./run.sh -x --- to draw a line if you call the other two examples together

# ##############################################################################

usage() {
echo "Usage statment"

format="%4s %-4s : %s\n"
printf "${format}" "Flag" "Arg" "Description"
printf "${format}" "----" "----" "----"
printf "${format}" "b" "" "Build command"
printf "${format}" "e" "" "Show a usage example"
printf "${format}" "x" "msg" "Prints out a message"
}

# ##############################################################################

# Behavior for no parameters
if [ $# -eq 0 ]; then
usage
exit 1
fi

while getopts bex: opt ; do
case "${opt}" in
b) go build -o gcss cmd/gcss/main.go ;;
e) cat test/0001.gcss | ./gcss ;;
x) echo "${OPTARG}" ;;
*) usage ;;
esac
done