/[aya]/vendor/github.com/yosssi/gcss/README.md
ViewVC logotype

Contents of /vendor/github.com/yosssi/gcss/README.md

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations)
Mon Sep 30 00:42:06 2024 UTC (6 weeks, 4 days ago) by yakumo_izuru
Branch: MAIN
CVS Tags: HEAD
Mirrored from https://git.chaotic.ninja/git/yakumo_izuru/aya

1 # GCSS - Pure Go CSS Preprocessor
2
3 [![wercker status](https://app.wercker.com/status/4857161fd705e6c43df492e6a33ce87f/m "wercker status")](https://app.wercker.com/project/bykey/4857161fd705e6c43df492e6a33ce87f)
4 [![Build status](https://ci.appveyor.com/api/projects/status/ocbu6upgr3j0m3vc/branch/master)](https://ci.appveyor.com/project/yosssi/gcss/branch/master)
5 [![Coverage Status](https://img.shields.io/coveralls/yosssi/gcss.svg)](https://coveralls.io/r/yosssi/gcss?branch=master)
6 [![GoDoc](http://godoc.org/github.com/yosssi/gcss?status.svg)](http://godoc.org/github.com/yosssi/gcss)
7 [![Gitter](https://badges.gitter.im/Join Chat.svg)](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

nishi@chaotic.ninja
ViewVC Help
Powered by ViewVC 1.3.0-dev