source

package
v0.0.0-...-5073c34 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package source holds all the assets for Statup. This includes CSS, JS, SCSS, HTML and other website related content. This package uses Rice to compile all assets into a single 'rice-box.go' file.

Required Dependencies

- rice -> https://github.com/GeertJohan/go.rice - sass -> https://sass-lang.com/install

Compile Assets

To compile all the HTML, JS, SCSS, CSS and image assets you'll need to have rice and sass installed on your local system.

sass source/scss/base.scss source/css/base.css
cd source && rice embed-go

More info on: https://github.com/hunterlong/statup

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	CssBox  *rice.Box // CSS files from the 'source/css' directory, this will be loaded into '/assets/css'
	ScssBox *rice.Box // SCSS files from the 'source/scss' directory, this will be loaded into '/assets/scss'
	JsBox   *rice.Box // JS files from the 'source/js' directory, this will be loaded into '/assets/js'
	TmplBox *rice.Box // HTML and other small files from the 'source/tmpl' directory, this will be loaded into '/assets'
	FontBox *rice.Box // HTML and other small files from the 'source/tmpl' directory, this will be loaded into '/assets'
)

Functions

func Assets

func Assets()

Assets will load the Rice boxes containing the CSS, SCSS, JS, and HTML files.

func CompileSASS

func CompileSASS(folder string) error

CompileSASS will attempt to compile the SASS files into CSS

func CopyAllToPublic

func CopyAllToPublic(box *rice.Box, folder string) error

CopyAllToPublic will copy all the files in a rice box into a local folder

func CopyToPublic

func CopyToPublic(box *rice.Box, folder, file string) error

CopyToPublic will create a file from a rice Box to the '/assets' directory

func CreateAllAssets

func CreateAllAssets(folder string) error

CreateAllAssets will dump HTML, CSS, SCSS, and JS assets into the '/assets' directory

func DeleteAllAssets

func DeleteAllAssets(folder string) error

DeleteAllAssets will delete the '/assets' folder

func HelpMarkdown

func HelpMarkdown() string

HelpMarkdown will return the Markdown of help.md into HTML

func MakePublicFolder

func MakePublicFolder(folder string) error

MakePublicFolder will create a new folder

func OpenAsset

func OpenAsset(folder, file string) string

OpenAsset returns a file's contents as a string

Example
OpenAsset("js", "main.js")
Output:

func SaveAsset

func SaveAsset(data []byte, folder, file string) error

SaveAsset will save an asset to the '/assets/' folder.

Example
data := []byte("alert('helloooo')")
SaveAsset(data, "js", "test.js")
Output:

func UsingAssets

func UsingAssets(folder string) bool

UsingAssets returns true if the '/assets' folder is found in the directory

Types

This section is empty.

Jump to

Keyboard shortcuts

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