Last active
April 3, 2024 00:36
-
-
Save lgladdy/f11d71cba6ce5b6f460778e461dd84a7 to your computer and use it in GitHub Desktop.
Revisions
-
lgladdy revised this gist
Mar 8, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -21,10 +21,10 @@ plugins: [ for (const [color, value] of Object.entries(paletteColors)) { addComponents({ [`.wp-block .has-${_.kebabCase(color)}-background-color`]: { backgroundColor: value, }, [`.wp-block .has-${_.kebabCase(color)}-color`]: { color: value, } }) -
lgladdy created this gist
Mar 8, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ const _ = require('lodash') const plugin = require('tailwindcss/plugin') plugins: [ plugin(function({ addComponents, theme }) { const colors = theme('colors', {}) const exclude = ['transparent', 'current'] const paletteColors = [] for (const [key, value] of Object.entries(colors)) { if ('string' == typeof(value)) { if (_.includes(exclude, key)) continue; paletteColors[key] = value } else { for (const [subkey, subvalue] of Object.entries(value)) { if (_.includes(exclude, key)) continue; paletteColors[key+'-'+subkey] = subvalue } } } for (const [color, value] of Object.entries(paletteColors)) { addComponents({ [`.has-${_.kebabCase(color)}-background-color`]: { backgroundColor: value, }, [`.has-${_.kebabCase(color)}-color`]: { color: value, } }) } }) ]