postcss

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package postcss provides a PostCSS plugin for GoSPA with Tailwind CSS v4 support. It processes CSS through PostCSS with configurable plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Input is the source CSS file (default: styles/main.css).
	Input string `yaml:"input" json:"input"`
	// Output is the processed CSS file (default: static/css/main.css).
	Output string `yaml:"output" json:"output"`
	// Watch enables watch mode for development.
	Watch bool `yaml:"watch" json:"watch"`
	// Minify enables CSS minification in production.
	Minify bool `yaml:"minify" json:"minify"`
	// SourceMap enables source map generation.
	SourceMap bool `yaml:"sourceMap" json:"sourceMap"`
	// Plugins configures which PostCSS plugins to enable.
	Plugins PluginConfig `yaml:"plugins" json:"plugins"`
}

Config holds PostCSS plugin configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default PostCSS plugin configuration.

type PluginConfig

type PluginConfig struct {
	// Typography enables @tailwindcss/typography (prose classes).
	Typography bool `yaml:"typography" json:"typography"`
	// Forms enables @tailwindcss/forms (form styling).
	Forms bool `yaml:"forms" json:"forms"`
	// AspectRatio enables @tailwindcss/aspect-ratio.
	AspectRatio bool `yaml:"aspectRatio" json:"aspectRatio"`
	// Autoprefixer enables autoprefixer for vendor prefixes.
	Autoprefixer bool `yaml:"autoprefixer" json:"autoprefixer"`
	// CSSNano enables cssnano for minification.
	CSSNano bool `yaml:"cssnano" json:"cssnano"`
	// PostCSSNested enables postcss-nested for nested CSS.
	PostCSSNested bool `yaml:"postcssNested" json:"postcssNested"`
}

PluginConfig configures individual PostCSS plugins. Note: ContainerQueries and LineClamp are built into Tailwind v4.

type PostCSSPlugin

type PostCSSPlugin struct {
	// contains filtered or unexported fields
}

PostCSSPlugin provides PostCSS processing with Tailwind CSS v4 support.

func New

func New() *PostCSSPlugin

New creates a new PostCSS plugin with default configuration.

func NewWithConfig

func NewWithConfig(cfg *Config) *PostCSSPlugin

NewWithConfig creates a new PostCSS plugin with the given configuration.

func (*PostCSSPlugin) Commands

func (p *PostCSSPlugin) Commands() []plugin.Command

Commands returns custom CLI commands.

func (*PostCSSPlugin) Dependencies

func (p *PostCSSPlugin) Dependencies() []plugin.Dependency

Dependencies returns the required Bun packages for PostCSS.

func (*PostCSSPlugin) GetConfig

func (p *PostCSSPlugin) GetConfig() *Config

GetConfig returns the current configuration.

func (*PostCSSPlugin) Init

func (p *PostCSSPlugin) Init() error

Init initializes the PostCSS plugin.

func (*PostCSSPlugin) Name

func (p *PostCSSPlugin) Name() string

Name returns the plugin name.

func (*PostCSSPlugin) OnHook

func (p *PostCSSPlugin) OnHook(hook plugin.Hook, ctx map[string]interface{}) error

OnHook handles lifecycle hooks.

func (*PostCSSPlugin) SetConfig

func (p *PostCSSPlugin) SetConfig(cfg *Config)

SetConfig updates the configuration.

func (*PostCSSPlugin) Stop

func (p *PostCSSPlugin) Stop()

Stop gracefully stops the PostCSS watcher.

Jump to

Keyboard shortcuts

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