8000 GitHub - Oudwins/tailwind-merge-go at v0.1.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Merge Tailwind CSS classes without style conflicts in Go

License

Notifications You must be signed in to change notification settings

Oudwins/tailwind-merge-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tailwind-merge-go

Utility function to efficiently merge Tailwind CSS classes in Golang without style conflicts. This library aims to be as close as possible to a 1:1 copy of the original dcastil/tailwind-merge library written in javascript.

import (
	"fmt"

	"github.com/Oudwins/tailwind-merge-go/pkg/twmerge"
)

func main() {

	// example usage
	c := twmerge.Merge("px-4 px-10 p-1")
	fmt.Println(c) // "p-1"
}
  • Supports Tailwind v3.0 up to v3.4
  • Support for extending the default configuration
  • Support for providing your own caching solution
  • Its in 0.1.0, can I use it? Sure! I will personally be deploying this to prod. It's only in pre 1.0 because there some extra features I want to add before the 1.0 release (see roadmap)

Roadmap

  • Write contributing docs
  • Improve current docs
  • Improve cache concurrent performance by locking on a per key basis -> https://github.com/EagleChen/mapmutex
  • Split code into multiple pkgs so in the twmerge pkg there is only the Merge & CreateTailwindMerge functions
  • Build the class map on initialization and have a simple config style
  • replace regex with more performant solution
  • Move arbitrary value delimeters '[' & ']' to config somehow?
  • Plugins & easy plugin api.

Acknowledgments

  • Credit for all the hard work goes to dcastil/tailwind-merge.
    • For the tests I used
    • For the approach and the code. I mostly translated from js to go
  • Big thank you to tylantz/go-tailwind-merge/ for pushing me to finally do this by writing a very interesting version of this same idea (I encourage you to check it out) and for the code to generate a go test file based on tailwind-merge's tests

About

Merge Tailwind CSS classes without style conflicts in Go

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •  

Languages

0