Skip to content

Commit

Permalink
refactor: remove unnecessary @defaults modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
dgknca committed Mar 1, 2023
1 parent 6705b33 commit 17462cd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailwindcss-full-bleed",
"version": "2.0.0",
"version": "2.0.1",
"main": "src/index.js",
"types": "src/index.d.ts",
"license": "MIT",
Expand Down
24 changes: 1 addition & 23 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,15 @@ const plugin = require('tailwindcss/plugin')
const flattenColorPalette = require('tailwindcss/lib/util/flattenColorPalette').default
const toColorValue = require('tailwindcss/lib/util/toColorValue').default

const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities, theme }) {
addDefaults('bleed-bg', {
'--tw-full-bleed-color': 'theme(colors.neutral.200)',
})

addDefaults('bleed-border', {
'--tw-full-bleed-border-top-width': '1px',
'--tw-full-bleed-border-bottom-width': '1px',
})

const fullBleed = plugin(function ({ matchUtilities, addUtilities, theme }) {
addUtilities({
'.bleed-bg': {
'@defaults bleed-bg': {},
'border-image': 'linear-gradient(var(--tw-full-bleed-color) 0 0) fill 0/ /0 100vw 0 100vw',
},
'.bleed-bg-r': {
'@defaults bleed-bg': {},
'border-image': 'linear-gradient(var(--tw-full-bleed-color) 0 0) fill 0/ /0 100vw 0 0',
},
'.bleed-bg-l': {
'@defaults bleed-bg': {},
'border-image': 'linear-gradient(var(--tw-full-bleed-color) 0 0) fill 0/ /0 0 0 100vw',
},
'.bleed-none': {
Expand Down Expand Up @@ -52,7 +40,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 100vw'],
Expand All @@ -64,7 +51,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-t',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 100vw'],
['border-top', 'var(--tw-full-bleed-border-top-width) solid'],
Expand All @@ -73,7 +59,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-b',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 100vw'],
['border-bottom', 'var(--tw-full-bleed-border-bottom-width) solid'],
Expand All @@ -82,7 +67,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-r',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 0'],
Expand All @@ -93,7 +77,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-l',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 0 0 100vw'],
Expand All @@ -104,7 +87,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-tl',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 0 0 100vw'],
['border-top', 'var(--tw-full-bleed-border-top-width) solid'],
Expand All @@ -113,7 +95,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-tr',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-top-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 0'],
['border-top', 'var(--tw-full-bleed-border-top-width) solid'],
Expand All @@ -122,7 +103,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-bl',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 0 0 100vw'],
['border-bottom', 'var(--tw-full-bleed-border-bottom-width) solid'],
Expand All @@ -131,7 +111,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
[
'bleed-border-br',
[
['@defaults bleed-border', {}],
'--tw-full-bleed-border-bottom-width',
['border-image', 'linear-gradient(var(--tw-full-bleed-color) 0 0) 1 / /0 100vw 0 0'],
['border-bottom', 'var(--tw-full-bleed-border-bottom-width) solid'],
Expand All @@ -156,7 +135,6 @@ const fullBleed = plugin(function ({ matchUtilities, addDefaults, addUtilities,
if (Array.isArray(name)) {
return Object.assign(obj, { [name[0]]: name[1] })
}
// return Object.assign(obj, { [name]: transformValue(value) })
return Object.assign(obj, { [name]: value })
}, {})
},
Expand Down
6 changes: 0 additions & 6 deletions website/styles/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,6 @@ video {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-full-bleed-color: #e5e5e5;
--tw-full-bleed-border-top-width: 1px;
--tw-full-bleed-border-bottom-width: 1px;
}

::backdrop {
Expand Down Expand Up @@ -514,9 +511,6 @@ video {
--tw-backdrop-opacity: ;
--tw-backdrop-saturate: ;
--tw-backdrop-sepia: ;
--tw-full-bleed-color: #e5e5e5;
--tw-full-bleed-border-top-width: 1px;
--tw-full-bleed-border-bottom-width: 1px;
}

.mx-auto {
Expand Down

0 comments on commit 17462cd

Please sign in to comment.