func (f *File) LocalPath() string {
	return f.path
}
LocalPath returns the relative path of this file
package assets
import (
	"bytes"
	"fmt"
	"io/ioutil"
	"os"
	"path"
	"strings"
)
const permissions = 0744
type File struct {
	name  string
	hash  string
	path  string
	bytes []byte
}
func NewFile(p string) (*File, error) {
	bytes, err := ioutil.ReadFile(p)
	if err != nil {
		return &File{}, err
	}
	file := &File{
		path:  p,
		name:  path.Base(p),
		hash:  bytesHash(bytes),
		bytes: bytes,
	}
	return file, nil
}
func (f *File) Style() bool {
	return strings.HasSuffix(f.name, ".css")
}
func (f *File) Script() bool {
	return strings.HasSuffix(f.name, ".js")
}
func (f *File) MarshalJSON() ([]byte, error) {
	var b bytes.Buffer
	s := fmt.Sprintf("\"%s\":\"%s\"", f.path, f.hash)
	b.WriteString(s)
	return b.Bytes(), nil
}
func (f *File) Newer(dst string) bool {
	stat, err := os.Stat(f.path)
	if err != nil {
		return false
	}
	srcM := stat.ModTime()
	stat, err = os.Stat(dst)
	if os.IsNotExist(err) {
		return true
	}
	if err != nil {
		return false
	}
	dstM := stat.ModTime()
	return srcM.After(dstM)
}
func (f *File) Copy(dst string) error {
	err := ioutil.WriteFile(dst, f.bytes, permissions)
	if err != nil {
		return err
	}
	return nil
}