Skip to content

Latest commit

 

History

History
57 lines (34 loc) · 1.51 KB

README.src.md

File metadata and controls

57 lines (34 loc) · 1.51 KB

{name}

{go:header}

Packs the assets for your web server.

{go:install}

Usage

pack usage

Run pack in your project directory. It will scan your project directory recursively to compile .pixy, .scarlet and .js files resulting in a components package in your root directory. You can then import the components package in your project to access all of your assets.

Pack is silent by default. Use pack -v to produce a verbose output.

Performance

Pack uses parallel compilation via job queues and is therefore extremely fast, much faster than the popular webpack.

Components

Since components is a generated directory you should list this directory in your .gitignore file.

CSS

import "github.com/YOUR_ORG/YOUR_REPO/components/css"
css.Bundle()

Returns the CSS bundle which is a string of CSS containing all styles.

JS

import "github.com/YOUR_ORG/YOUR_REPO/components/js"
js.Bundle()

Returns the JS bundle which is a string of JS containing all scripts.

Templates

import "github.com/YOUR_ORG/YOUR_REPO/components"

Templates are registered as public functions in the components package and can be called directly. All components are global, thus you can call a component from one file in another file without any import directives. Components return an HTML string but they use a single strings.Builder via pooling and streaming under the hood, which is extremely fast.

{go:footer}