esbuild-plugins

module
v0.0.0-...-3fd54a5 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MPL-2.0

README

esbuild-plugins

A collection of Go plugins for esbuild.

Plugins

postcss

This plugin can be used to automatically process included CSS files using postcss. It supports a few options:

  • Command: defaults to npx postcss, the command to run postcss. This must be a command name with all required arguments. Quotes are supported (pseudo-shell).
  • Filter: defaults to \.(s?css|sass)$, a regular expression to match files that should be processed by postcss.
package main

import (
	"github.com/evanw/esbuild/pkg/api"
	"github.com/LouisBrunner/esbuild-plugins/pkg/postcss"
)

func main() {
	result := api.Build(api.BuildOptions{
		EntryPoints: []string{"app.js"},
		Bundle:      true,
		Outfile:     "out.js",
		Plugins: []api.Plugin{postcss.Must(postcss.NewPlugin(postcss.Options{
			Command: "npx postcss",
			Filter:  `\.(s?css|sass)$`,
		}))},
		Write: true,
	})

	if len(result.Errors) > 0 {
		os.Exit(1)
	}
}

Notes:

  • By default, this plugin assumes you have npx and postcss installed and in your PATH.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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