assets

package module
v0.0.0-...-5cefce6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2017 License: MIT Imports: 16 Imported by: 1

README

assets

Build Status Go Report Card GoDoc

assets is a simple + lightweight Asset Pipeline for Go HTML applications

Why

Couldn't find a good one that wasn't a mess or didn't rely on some other language to compress the assets.

What's missing

Currently this library doesn't compress the combined files, when using Gzip it's not that big of a deal, however once an established js and css compressor is created it can be added seamlessly; pull requests are welcome to help

Installation

Use go get

go get github.com/go-playground/assets/cmd/assets

or to update

go get -u github.com/go-playground/assets/cmd/assets

Then import assets package into your code.

import "github.com/go-playground/assets"
Command Line Use

assets -h

Usage of assets:
  -i string
    	Asset directory to bundle files for recursivly.
  -ignore string
    	Regexp for files/dirs we should ignore i.e. \.gitignore.
  -ld string
    	The Left Delimiter for file includes
  -o string
    	Output directory, if blank will use -i option DIR.
  -rd string
    	The Right Delimiter for file includes
  -rtd
    	Specifies if the files included should be treated as relative to the directory, or relative to the files from which they are included. (default true)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(dirname string, outputDir string, relativeToDir bool, leftDelim string, rightDelim string, extensions map[string]struct{}) ([]*bundler.ProcessedFile, string, error)

Generate processes (bundles, compresses...) the assets for use and creates the Manifest file NOTE: no compression yet until there is a native and establishes compressor written in Go

func LoadManifestFiles

func LoadManifestFiles(dirname string, mode RunMode, relativeToDir bool, leftDelim string, rightDelim string) (template.FuncMap, error)

LoadManifestFiles reads the manifest file generated by the Generate() command in Production mode and returns template.FuncMap for the provided RunMode

func ProcessManifestFiles

func ProcessManifestFiles(manifest io.Reader, dirname string, mode RunMode, relativeToDir bool, leftDelim string, rightDelim string) (template.FuncMap, error)

ProcessManifestFiles reads an existing manifest file generated by the Generate() command in Production mode and returns template.FuncMap for the provided RunMode

Types

type RunMode

type RunMode int

RunMode is the type that determines which mode the template.FuncMap functions whould run in.

const (
	Development RunMode = iota
	Production
)

RunMode's

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL