Skip to content
This repository was archived by the owner on Aug 3, 2020. It is now read-only.

Commit d2af85d

Browse files
authored
Use tailwindcss/plugin for plugin declaration (#12)
* Implement customization for spinner class name and tailwind theme key * Add test for custom spinner class name and tailwind theme key * Improve readme with class name and tailwind theme key configuration * Add test (skipped) for passing direct plugin require() result into tailwind config * Use tailwindcss/plugin to create plugin function Co-authored-by: kacah <deniss.paltovs@gmail.com>
1 parent a9f7f60 commit d2af85d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const _ = require('lodash')
22
const flatten = require('flat')
3+
const plugin = require('tailwindcss/plugin')
34

45

56
const FLATTEN_CONFIG = { delimiter: '-', maxDepth: 2 }
@@ -16,7 +17,7 @@ const prefixNegativeModifiers = function(base, modifier) {
1617
}
1718

1819

19-
module.exports = function (spinnerConfig = {}) {
20+
function pluginFactory(spinnerConfig = {}) {
2021
return function ({
2122
addUtilities, addComponents, addBase, addVariant,
2223
e, prefix, theme, variants, config,
@@ -118,3 +119,5 @@ module.exports = function (spinnerConfig = {}) {
118119
})
119120
}
120121
}
122+
123+
module.exports = plugin.withOptions(pluginFactory)

test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const generatePluginCss = (testConfig = {}, pluginOptions) => {
2626
.then(result => result.css)
2727
}
2828

29-
test.skip('can not pass direct require() into tailwind plugin', () => {
29+
test('can pass direct require() into tailwind plugin', () => {
3030
const sandboxConfig = {
3131
theme: {
3232
screens: { 'sm': '640px' },

0 commit comments

Comments
 (0)