-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Oudwins/import-refactor
feat: better support & docs for providing a custom configuration or cache
- Loading branch information
Showing
8 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
lru "github.com/Oudwins/tailwind-merge-go/pkg/lru" | ||
twmerge "github.com/Oudwins/tailwind-merge-go/pkg/twmerge" | ||
) | ||
|
||
var TwMerger twmerge.TwMergeFn | ||
|
||
func main() { | ||
// get the default config | ||
config := twmerge.MakeDefaultConfig() | ||
|
||
// make cache | ||
cache := lru.Make(10000) | ||
|
||
// do your modifications here | ||
|
||
// create the merger | ||
TwMerger = twmerge.CreateTwMerge(config, cache) | ||
|
||
// example usage | ||
m := TwMerger("px-4 px-10", "p-20") | ||
fmt.Println(m) // output: "p-20" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
twmerge "github.com/Oudwins/tailwind-merge-go" | ||
) | ||
|
||
func main() { | ||
// mainly used for manual tests | ||
|
||
// example usage | ||
m := twmerge.Merge("px-4 px-10", "p-20") | ||
fmt.Println(m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package cache | ||
|
||
type ICache interface { | ||
Get(string) string | ||
Set(string, string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package twmerge | ||
|
||
import ( | ||
twmerge "github.com/Oudwins/tailwind-merge-go/pkg/twmerge" | ||
) | ||
|
||
var Merge = twmerge.Merge |