wip/go-rice 1.0.2nb3 NetBSD
Working with resources such as html, js, css, images, templates
- System
- NetBSD
- Repository
- pkgsrc-wip
- Maintainer
- [email protected]
- License
- 2-clause-bsd
- Categories
- wip, www
Description
TODO: Adjust the following lines from README.md
# go.rice
[](https://travis-ci.org/GeertJohan/go.rice) [](https://godoc.org/github.com/GeertJohan/go.rice)
go.rice is a [Go](http://golang.org) package that makes working with resources such as html,js,css,images and templates easy. During development `go.rice` will load required files directly from disk. Upon deployment it's easy to add all resource files to a executable using the `rice` tool, without changing the source code for your package. go.rice provides methods to add resources to a binary in different scenarios.
## What does it do
The first thing go.rice does is finding the correct absolute path for your resource files. Say you are executing a binary in your home directory, but your `html-files` are in `$GOPATH/src/yourApplication/html-files`. `go.rice` will lookup the correct path for that directory (relative to the location of yourApplication). All you have to do is include the resources using `rice.FindBox("html-files")`.
This works fine when the source is available to the machine executing the binary, which is the case when installing the executable with `go get` or `go install`. But it does not work when you wish to provide a single binary without source. This is where the `rice` tool comes in. It analyses source code and finds call's to `rice.FindBox(..)`. Then it adds the required directories to the executable binary, There are two strategies to do this. You can 'embed' the assets by generating go source code and then compile them into the executable binary, or you can 'append' the assets to the executable binary after compiling. In both cases the `rice.FindBox(..)` call detects the embedded or appended resources and load those, instead of looking up files from disk.
## Installation
Use `go get` to install the package the `rice` tool.
```bash go get github.com/GeertJohan/go.rice go get github.com/GeertJohan/go.rice/rice ...
Install
From pkgsrc-wip (no binary package):
cd /usr/pkgsrc/wip/go-rice && make install clean
Dependencies
No port depends on this one.