Documentation
¶
Overview ¶
Package tailwind manages the pinned Tailwind CSS standalone binary (REQ-STY-01). It downloads the binary for the host platform, verifies the sha256 from gx.lock and runs it. Node is never involved.
Index ¶
- Constants
- func Asset(goos, goarch string) (string, error)
- type Lock
- type LockEntry
- type Manager
- func (m *Manager) Build(ctx context.Context, themePath string, minify bool) ([]byte, error)
- func (m *Manager) BuildInput(ctx context.Context, input []byte, dir, out string) ([]byte, error)
- func (m *Manager) Ensure(ctx context.Context) (string, error)
- func (m *Manager) Run(ctx context.Context, args ...string) ([]byte, error)
- func (m *Manager) Vendor(ctx context.Context) (string, error)
Constants ¶
const DefaultBaseURL = "https://github.com/tailwindlabs/tailwindcss/releases/download"
DefaultBaseURL is the release download root.
const DefaultVersion = "v4.3.3"
DefaultVersion is the pinned Tailwind release.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Lock ¶
type Lock struct {
Tailwind LockEntry `json:"tailwind"`
}
Lock is the gx.lock shape. The file is machine-written.
func DefaultLock ¶
func DefaultLock() Lock
DefaultLock returns the built-in pin of the official release.
type LockEntry ¶
type LockEntry struct {
Version string `json:"version"`
SHA256 map[string]string `json:"sha256,omitempty"`
}
LockEntry pins one tool.
type Manager ¶
type Manager struct {
// Root is the module root that holds gx.lock and gx.toml.
Root string
// Cache overrides the binary cache directory.
Cache string
// BaseURL overrides the release download root, for mirrors (REQ-STY-12)
// and tests.
BaseURL string
// Client is the HTTP client, or http.DefaultClient.
Client *http.Client
}
Manager fetches and runs the pinned binary.
func (*Manager) Build ¶
Build runs the pinned Tailwind binary on themePath and returns the CSS (REQ-STY-02). The output also lands in .gx/app.css.
func (*Manager) BuildInput ¶ added in v0.3.0
BuildInput runs the pinned binary on a stylesheet that it gets on the standard input, with dir as the working directory, and returns the minified CSS (REQ-ISL-11). The relative paths of the input start at dir.
func (*Manager) Ensure ¶
Ensure returns the path of the verified binary, downloading it when the cache is cold (REQ-STY-01).