stylecat

package module
v0.0.0-...-83e8e1c Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2018 License: MIT Imports: 5 Imported by: 0

README

stylecat Go Report Card Build Status

Concatenate @import CSS references into a single stylesheet.

Usage

import (
  "github.com/ef2k/stylecat"
)

func main() {
    src, err := stylecat.Run("/the/path/to/public/css/master.css", nil)
}

When stylesheets link to absolute paths e.g: /css/master.css, set a RootPath:

src, err := stylecat.Run("/the/path/to/public/css/master.css", &stylecat.Config{
  RootPath: "/the/path/to/public"
})

Documentation

GoDoc

Contributions

Fixes? Ideas? Improvements? Jump in. All are welcome!

License

MIT.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(entryPath string, c *Config) ([]byte, error)

Run will concatenate all CSS files referenced by @import statements at the given `entryPath`.

Types

type Config

type Config struct {

	// RootPath will set stylecat to use a fixed absolute path to determine the
	// paths of imported CSS with absolute URL references.
	// For example, `@import url('/css/base.css')` points to a root URL path that
	// has a filesystem path at `/var/www/.../public/css/base.css`. Setting `RootPath`
	// to `/var/www/.../public`, will resolve the correct path for the CSS references.
	// Note that RootPath is only needed for @import paths that are absolute.
	RootPath string
}

Config configures stylecat.

Jump to

Keyboard shortcuts

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