Mercurial > yakumo_izuru > aya
comparison vendor/github.com/yosssi/gcss/README.md @ 66:787b5ee0289d draft
Use vendored modules
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>
| author | yakumo.izuru |
|---|---|
| date | Sun, 23 Jul 2023 13:18:53 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 65:6d985efa0f7a | 66:787b5ee0289d |
|---|---|
| 1 # GCSS - Pure Go CSS Preprocessor | |
| 2 | |
| 3 [](https://app.wercker.com/project/bykey/4857161fd705e6c43df492e6a33ce87f) | |
| 4 [](https://ci.appveyor.com/project/yosssi/gcss/branch/master) | |
| 5 [](https://coveralls.io/r/yosssi/gcss?branch=master) | |
| 6 [](http://godoc.org/github.com/yosssi/gcss) | |
| 7 [](https://gitter.im/yosssi/gcss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) | |
| 8 | |
| 9 ## Overview | |
| 10 | |
| 11 GCSS is a pure Go CSS preprocessor. This is inspired by [Sass](http://sass-lang.com/) and [Stylus](http://learnboost.github.io/stylus/). | |
| 12 | |
| 13 ## Syntax | |
| 14 | |
| 15 ### Variables | |
| 16 | |
| 17 ```scss | |
| 18 $base-font: Helvetica, sans-serif | |
| 19 $main-color: blue | |
| 20 | |
| 21 body | |
| 22 font: 100% $base-font | |
| 23 color: $main-color | |
| 24 ``` | |
| 25 | |
| 26 ### Nesting | |
| 27 | |
| 28 ```scss | |
| 29 nav | |
| 30 ul | |
| 31 margin: 0 | |
| 32 padding: 0 | |
| 33 | |
| 34 a | |
| 35 color: blue | |
| 36 &:hover | |
| 37 color: red | |
| 38 ``` | |
| 39 | |
| 40 ### Mixins | |
| 41 | |
| 42 ```scss | |
| 43 $border-radius($radius) | |
| 44 -webkit-border-radius: $radius | |
| 45 -moz-border-radius: $radius | |
| 46 -ms-border-radius: $radius | |
| 47 border-radius: $radius | |
| 48 | |
| 49 .box | |
| 50 $border-radius(10px) | |
| 51 ``` | |
| 52 | |
| 53 ## Installation | |
| 54 | |
| 55 ```sh | |
| 56 $ go get -u github.com/yosssi/gcss/... | |
| 57 ``` | |
| 58 | |
| 59 ## Compile from the Command-Line | |
| 60 | |
| 61 ```sh | |
| 62 $ gcss /path/to/gcss/file | |
| 63 ``` | |
| 64 | |
| 65 or | |
| 66 | |
| 67 ```sh | |
| 68 $ cat /path/to/gcss/file | gcss > /path/to/css/file | |
| 69 ``` | |
| 70 | |
| 71 ## Compile from Go programs | |
| 72 | |
| 73 You can compile a GCSS file from Go programs by invoking the `gcss.CompileFile` function. | |
| 74 | |
| 75 ```go | |
| 76 cssPath, err := gcss.CompileFile("path_to_gcss_file") | |
| 77 | |
| 78 if err != nil { | |
| 79 http.Error(w, err.Error(), http.StatusInternalServerError) | |
| 80 return | |
| 81 } | |
| 82 | |
| 83 http.ServeFile(w, r, cssPath) | |
| 84 ``` | |
| 85 | |
| 86 You can invoke the `gcss.Compile` function instead of the `gcss.CompileFile` function. The `gcss.Compile` function takes `io.Writer` and `io.Reader` as a parameter, compiles the GCSS data which is read from the `io.Reader` and writes the result CSS data to the `io.Writer`. Please see the [GoDoc](http://godoc.org/github.com/yosssi/gcss) for the details. | |
| 87 | |
| 88 ```go | |
| 89 f, err := os.Open("path_to_gcss_file") | |
| 90 | |
| 91 if err != nil { | |
| 92 panic(err) | |
| 93 } | |
| 94 | |
| 95 defer func() { | |
| 96 if err := f.Close(); err != nil { | |
| 97 panic(err) | |
| 98 } | |
| 99 }() | |
| 100 | |
| 101 n, err := gcss.Compile(os.Stdout, f) | |
| 102 ``` | |
| 103 | |
| 104 ## Documentation | |
| 105 | |
| 106 * [GoDoc](http://godoc.org/github.com/yosssi/gcss) | |
| 107 | |
| 108 ## Syntax Highlightings | |
| 109 | |
| 110 * [vim-gcss](https://github.com/yosssi/vim-gcss) - Vim syntax highlighting for GCSS |
