https://github.com/weisjohn/cssrefs
Package cssrefs returns a slice of `Reference{URI, Token string}`s from an `io.Reader`.
https://github.com/weisjohn/cssrefs
Last synced: over 1 year ago
JSON representation
Package cssrefs returns a slice of `Reference{URI, Token string}`s from an `io.Reader`.
- Host: GitHub
- URL: https://github.com/weisjohn/cssrefs
- Owner: weisjohn
- License: mit
- Created: 2015-02-17T04:15:03.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-17T23:41:40.000Z (over 11 years ago)
- Last Synced: 2025-01-24T04:44:39.802Z (over 1 year ago)
- Language: Go
- Size: 141 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cssrefs
Package cssrefs returns a slice of `Reference{URI, Token string}`s from an `io.Reader`.
### usage
```go
package main
import (
"fmt"
"net/http"
"github.com/weisjohn/cssrefs"
)
func main() {
resp, _ := http.Get("http://johnweis.com/css/main.css")
refs := cssrefs.All(resp.Body)
for _, ref := range refs {
fmt.Println(ref.Token, ":", ref.URI)
}
}
```
### output
```bash
$ go run example-cssrefs.go
css : fineprint.css
font : ../fonts/bootstrap/glyphicons-halflings-regular.eot
font : ../fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix
font : ../fonts/bootstrap/glyphicons-halflings-regular.woff
font : ../fonts/bootstrap/glyphicons-halflings-regular.ttf
font : ../fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular
img : ../img/light_honeycomb_@2X.png
img : ../img/light_honeycomb.png
```
### struct
`cssrefs` returns a slice of `Reference`s
```go
type Reference struct {
URI, Token string
}
```
### credits
Inspired by https://github.com/weisjohn/htmlrefs