diff --git a/__tests__/applyAtRule.test.js b/__tests__/applyAtRule.test.js index a6f149457..410317402 100644 --- a/__tests__/applyAtRule.test.js +++ b/__tests__/applyAtRule.test.js @@ -1,12 +1,15 @@ import postcss from 'postcss' -import plugin from '../src/lib/substituteClassApplyAtRules' -import generateUtilities from '../src/legacy/generateUtilities' +import substituteClassApplyAtRules from '../src/lib/substituteClassApplyAtRules' +import processPlugins from '../src/util/processPlugins' +import defaultPlugins from '../src/defaultPlugins' import defaultConfig from '../defaultConfig.stub.js' -const defaultUtilities = generateUtilities(defaultConfig, []) +const { utilities: defaultUtilities } = processPlugins(defaultPlugins(defaultConfig), defaultConfig) function run(input, config = defaultConfig, utilities = defaultUtilities) { - return postcss([plugin(config, utilities)]).process(input, { from: undefined }) + return postcss([substituteClassApplyAtRules(config, utilities)]).process(input, { + from: undefined, + }) } test("it copies a class's declarations into itself", () => { @@ -206,10 +209,12 @@ test('you can apply utility classes without using the given prefix', () => { experiments: { shadowLookup: true }, } - return run(input, config, generateUtilities(config, [])).then(result => { - expect(result.css).toEqual(expected) - expect(result.warnings().length).toBe(0) - }) + return run(input, config, processPlugins(defaultPlugins(defaultConfig), config).utilities).then( + result => { + expect(result.css).toEqual(expected) + expect(result.warnings().length).toBe(0) + } + ) }) test('you can apply utility classes without using the given prefix when using a function for the prefix', () => { @@ -232,8 +237,10 @@ test('you can apply utility classes without using the given prefix when using a experiments: { shadowLookup: true }, } - return run(input, config, generateUtilities(config, [])).then(result => { - expect(result.css).toEqual(expected) - expect(result.warnings().length).toBe(0) - }) + return run(input, config, processPlugins(defaultPlugins(defaultConfig), config).utilities).then( + result => { + expect(result.css).toEqual(expected) + expect(result.warnings().length).toBe(0) + } + ) }) diff --git a/__tests__/containerPlugin.test.js b/__tests__/containerPlugin.test.js index 74d4ff763..9b0612e83 100644 --- a/__tests__/containerPlugin.test.js +++ b/__tests__/containerPlugin.test.js @@ -16,31 +16,13 @@ function config(overrides) { xl: '1200px', }, options: { - prefix: "", + prefix: '', important: false, - separator: ":" - } + separator: ':', + }, }) } -function processPluginsWithValidConfig(config) { - return processPlugins( - _.defaultsDeep(config, { - screens: { - sm: '576px', - md: '768px', - lg: '992px', - xl: '1200px', - }, - options: { - prefix: '', - important: false, - separator: ':', - }, - }) - ) -} - test.only('options are not required', () => { const { components } = processPlugins([container()], config()) @@ -62,14 +44,17 @@ test.only('options are not required', () => { }) test.only('screens can be specified explicitly', () => { - const { components } = processPlugins([ - container({ - screens: { - sm: '400px', - lg: '500px', - }, - }), - ], config()) + const { components } = processPlugins( + [ + container({ + screens: { + sm: '400px', + lg: '500px', + }, + }), + ], + config() + ) expect(css(components)).toMatchCss(` .container { width: 100% } @@ -83,11 +68,14 @@ test.only('screens can be specified explicitly', () => { }) test.only('screens can be an array', () => { - const { components } = processPlugins([ - container({ - screens: ['400px', '500px'], - }), - ], config()) + const { components } = processPlugins( + [ + container({ + screens: ['400px', '500px'], + }), + ], + config() + ) expect(css(components)).toMatchCss(` .container { width: 100% } @@ -101,11 +89,14 @@ test.only('screens can be an array', () => { }) test.only('the container can be centered by default', () => { - const { components } = processPlugins([ - container({ - center: true, - }), - ], config()) + const { components } = processPlugins( + [ + container({ + center: true, + }), + ], + config() + ) expect(css(components)).toMatchCss(` .container { @@ -129,11 +120,14 @@ test.only('the container can be centered by default', () => { }) test.only('horizontal padding can be included by default', () => { - const { components } = processPlugins([ - container({ - padding: '2rem', - }), - ], config()) + const { components } = processPlugins( + [ + container({ + padding: '2rem', + }), + ], + config() + ) expect(css(components)).toMatchCss(` .container { @@ -157,16 +151,19 @@ test.only('horizontal padding can be included by default', () => { }) test.only('setting all options at once', () => { - const { components } = processPlugins([ - container({ - screens: { - sm: '400px', - lg: '500px', - }, - center: true, - padding: '2rem', - }), - ], config()) + const { components } = processPlugins( + [ + container({ + screens: { + sm: '400px', + lg: '500px', + }, + center: true, + padding: '2rem', + }), + ], + config() + ) expect(css(components)).toMatchCss(` .container { diff --git a/__tests__/processPlugins.test.js b/__tests__/processPlugins.test.js index 300d8ccc8..84b90950e 100644 --- a/__tests__/processPlugins.test.js +++ b/__tests__/processPlugins.test.js @@ -1,39 +1,39 @@ -import _ from "lodash" -import postcss from "postcss" -import processPlugins from "../src/util/processPlugins" +import _ from 'lodash' +import postcss from 'postcss' +import processPlugins from '../src/util/processPlugins' function css(nodes) { return postcss.root({ nodes }).toString() } -function config(overrides) { +function makeConfig(overrides) { return _.defaultsDeep(overrides, { options: { - prefix: "", + prefix: '', important: false, - separator: ":" - } + separator: ':', + }, }) } -test("plugins can create utilities with object syntax", () => { +test('plugins can create utilities with object syntax', () => { const { components, utilities } = processPlugins( [ function({ addUtilities }) { addUtilities({ - ".object-fill": { - "object-fit": "fill" + '.object-fill': { + 'object-fit': 'fill', }, - ".object-contain": { - "object-fit": "contain" + '.object-contain': { + 'object-fit': 'contain', + }, + '.object-cover': { + 'object-fit': 'cover', }, - ".object-cover": { - "object-fit": "cover" - } }) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -52,30 +52,30 @@ test("plugins can create utilities with object syntax", () => { `) }) -test("plugins can create utilities with arrays of objects", () => { +test('plugins can create utilities with arrays of objects', () => { const { components, utilities } = processPlugins( [ function({ addUtilities }) { addUtilities([ { - ".object-fill": { - "object-fit": "fill" - } + '.object-fill': { + 'object-fit': 'fill', + }, }, { - ".object-contain": { - "object-fit": "contain" - } + '.object-contain': { + 'object-fit': 'contain', + }, }, { - ".object-cover": { - "object-fit": "cover" - } - } + '.object-cover': { + 'object-fit': 'cover', + }, + }, ]) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -94,33 +94,33 @@ test("plugins can create utilities with arrays of objects", () => { `) }) -test("plugins can create utilities with raw PostCSS nodes", () => { +test('plugins can create utilities with raw PostCSS nodes', () => { const { components, utilities } = processPlugins( [ function({ addUtilities }) { addUtilities([ - postcss.rule({ selector: ".object-fill" }).append([ + postcss.rule({ selector: '.object-fill' }).append([ postcss.decl({ - prop: "object-fit", - value: "fill" - }) + prop: 'object-fit', + value: 'fill', + }), ]), - postcss.rule({ selector: ".object-contain" }).append([ + postcss.rule({ selector: '.object-contain' }).append([ postcss.decl({ - prop: "object-fit", - value: "contain" - }) + prop: 'object-fit', + value: 'contain', + }), ]), - postcss.rule({ selector: ".object-cover" }).append([ + postcss.rule({ selector: '.object-cover' }).append([ postcss.decl({ - prop: "object-fit", - value: "cover" - }) - ]) + prop: 'object-fit', + value: 'cover', + }), + ]), ]) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -139,32 +139,32 @@ test("plugins can create utilities with raw PostCSS nodes", () => { `) }) -test("plugins can create utilities with mixed object styles and PostCSS nodes", () => { +test('plugins can create utilities with mixed object styles and PostCSS nodes', () => { const { components, utilities } = processPlugins( [ function({ addUtilities }) { addUtilities([ { - ".object-fill": { - objectFit: "fill" - } + '.object-fill': { + objectFit: 'fill', + }, }, - postcss.rule({ selector: ".object-contain" }).append([ + postcss.rule({ selector: '.object-contain' }).append([ postcss.decl({ - prop: "object-fit", - value: "contain" - }) + prop: 'object-fit', + value: 'contain', + }), ]), - postcss.rule({ selector: ".object-cover" }).append([ + postcss.rule({ selector: '.object-cover' }).append([ postcss.decl({ - prop: "object-fit", - value: "cover" - }) - ]) + prop: 'object-fit', + value: 'cover', + }), + ]), ]) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -183,27 +183,27 @@ test("plugins can create utilities with mixed object styles and PostCSS nodes", `) }) -test("plugins can create utilities with variants", () => { +test('plugins can create utilities with variants', () => { const { components, utilities } = processPlugins( [ function({ addUtilities }) { addUtilities( { - ".object-fill": { - "object-fit": "fill" + '.object-fill': { + 'object-fit': 'fill', }, - ".object-contain": { - "object-fit": "contain" + '.object-contain': { + 'object-fit': 'contain', + }, + '.object-cover': { + 'object-fit': 'cover', }, - ".object-cover": { - "object-fit": "cover" - } }, - ["responsive", "hover", "group-hover", "focus"] + ['responsive', 'hover', 'group-hover', 'focus'] ) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -222,24 +222,24 @@ test("plugins can create utilities with variants", () => { `) }) -test("plugins can create components with object syntax", () => { +test('plugins can create components with object syntax', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents({ - ".btn-blue": { - backgroundColor: "blue", - color: "white", - padding: ".5rem 1rem", - borderRadius: ".25rem" + '.btn-blue': { + backgroundColor: 'blue', + color: 'white', + padding: '.5rem 1rem', + borderRadius: '.25rem', + }, + '.btn-blue:hover': { + backgroundColor: 'darkblue', }, - ".btn-blue:hover": { - backgroundColor: "darkblue" - } }) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -256,39 +256,39 @@ test("plugins can create components with object syntax", () => { `) }) -test("plugins can create components with raw PostCSS nodes", () => { +test('plugins can create components with raw PostCSS nodes', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents([ - postcss.rule({ selector: ".btn-blue" }).append([ + postcss.rule({ selector: '.btn-blue' }).append([ postcss.decl({ - prop: "background-color", - value: "blue" + prop: 'background-color', + value: 'blue', }), postcss.decl({ - prop: "color", - value: "white" + prop: 'color', + value: 'white', }), postcss.decl({ - prop: "padding", - value: ".5rem 1rem" + prop: 'padding', + value: '.5rem 1rem', }), postcss.decl({ - prop: "border-radius", - value: ".25rem" - }) + prop: 'border-radius', + value: '.25rem', + }), ]), - postcss.rule({ selector: ".btn-blue:hover" }).append([ + postcss.rule({ selector: '.btn-blue:hover' }).append([ postcss.decl({ - prop: "background-color", - value: "darkblue" - }) - ]) + prop: 'background-color', + value: 'darkblue', + }), + ]), ]) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -305,38 +305,38 @@ test("plugins can create components with raw PostCSS nodes", () => { `) }) -test("plugins can create components with mixed object styles and raw PostCSS nodes", () => { +test('plugins can create components with mixed object styles and raw PostCSS nodes', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents([ - postcss.rule({ selector: ".btn-blue" }).append([ + postcss.rule({ selector: '.btn-blue' }).append([ postcss.decl({ - prop: "background-color", - value: "blue" + prop: 'background-color', + value: 'blue', }), postcss.decl({ - prop: "color", - value: "white" + prop: 'color', + value: 'white', }), postcss.decl({ - prop: "padding", - value: ".5rem 1rem" + prop: 'padding', + value: '.5rem 1rem', }), postcss.decl({ - prop: "border-radius", - value: ".25rem" - }) + prop: 'border-radius', + value: '.25rem', + }), ]), { - ".btn-blue:hover": { - backgroundColor: "darkblue" - } - } + '.btn-blue:hover': { + backgroundColor: 'darkblue', + }, + }, ]) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -353,33 +353,33 @@ test("plugins can create components with mixed object styles and raw PostCSS nod `) }) -test("plugins can create components with media queries with object syntax", () => { +test('plugins can create components with media queries with object syntax', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents({ - ".container": { - width: "100%" + '.container': { + width: '100%', }, - "@media (min-width: 100px)": { - ".container": { - maxWidth: "100px" - } + '@media (min-width: 100px)': { + '.container': { + maxWidth: '100px', + }, }, - "@media (min-width: 200px)": { - ".container": { - maxWidth: "200px" - } + '@media (min-width: 200px)': { + '.container': { + maxWidth: '200px', + }, + }, + '@media (min-width: 300px)': { + '.container': { + maxWidth: '300px', + }, }, - "@media (min-width: 300px)": { - ".container": { - maxWidth: "300px" - } - } }) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -405,36 +405,36 @@ test("plugins can create components with media queries with object syntax", () = `) }) -test("media queries can be defined multiple times using objects-in-array syntax", () => { +test('media queries can be defined multiple times using objects-in-array syntax', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents([ { - ".container": { - width: "100%" + '.container': { + width: '100%', + }, + '@media (min-width: 100px)': { + '.container': { + maxWidth: '100px', + }, }, - "@media (min-width: 100px)": { - ".container": { - maxWidth: "100px" - } - } }, { - ".btn": { - padding: "1rem .5rem", - display: "block" + '.btn': { + padding: '1rem .5rem', + display: 'block', }, - "@media (min-width: 100px)": { - ".btn": { - display: "inline-block" - } - } - } + '@media (min-width: 100px)': { + '.btn': { + display: 'inline-block', + }, + }, + }, ]) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -459,35 +459,35 @@ test("media queries can be defined multiple times using objects-in-array syntax" `) }) -test("plugins can create nested rules", () => { +test('plugins can create nested rules', () => { const { components, utilities } = processPlugins( [ function({ addComponents }) { addComponents({ - ".btn-blue": { - backgroundColor: "blue", - color: "white", - padding: ".5rem 1rem", - borderRadius: ".25rem", - "&:hover": { - backgroundColor: "darkblue" + '.btn-blue': { + backgroundColor: 'blue', + color: 'white', + padding: '.5rem 1rem', + borderRadius: '.25rem', + '&:hover': { + backgroundColor: 'darkblue', }, - "@media (min-width: 500px)": { - "&:hover": { - backgroundColor: "orange" - } + '@media (min-width: 500px)': { + '&:hover': { + backgroundColor: 'orange', + }, }, - "> a": { - color: "red" + '> a': { + color: 'red', }, - "h1 &": { - color: "purple" - } - } + 'h1 &': { + color: 'purple', + }, + }, }) - } + }, ], - config() + makeConfig() ) expect(utilities.length).toBe(0) @@ -515,18 +515,18 @@ test("plugins can create nested rules", () => { `) }) -test("plugins can create rules with escaped selectors", () => { +test('plugins can create rules with escaped selectors', () => { const { components, utilities } = processPlugins( [ function({ e, addUtilities }) { addUtilities({ - [`.${e("top-1/4")}`]: { - top: "25%" - } + [`.${e('top-1/4')}`]: { + top: '25%', + }, }) - } + }, ], - config() + makeConfig() ) expect(components.length).toBe(0) @@ -539,35 +539,35 @@ test("plugins can create rules with escaped selectors", () => { `) }) -test("plugins can access the current config", () => { +test('plugins can access the current config', () => { const { components, utilities } = processPlugins( [ function({ addComponents, config }) { const containerClasses = [ { - ".container": { - width: "100%" - } - } + '.container': { + width: '100%', + }, + }, ] - _.forEach(config("screens"), breakpoint => { + _.forEach(config('screens'), breakpoint => { containerClasses.push({ [`@media (min-width: ${breakpoint})`]: { - ".container": { maxWidth: breakpoint } - } + '.container': { maxWidth: breakpoint }, + }, }) }) addComponents(containerClasses) - } + }, ], - config({ + makeConfig({ screens: { - sm: "576px", - md: "768px", - lg: "992px", - xl: "1200px" - } + sm: '576px', + md: '768px', + lg: '992px', + xl: '1200px', + }, }) ) @@ -599,24 +599,24 @@ test("plugins can access the current config", () => { `) }) -test("plugins can provide fallbacks to keys missing from the config", () => { +test('plugins can provide fallbacks to keys missing from the config', () => { const { components, utilities } = processPlugins( [ function({ addComponents, config }) { addComponents({ - ".btn": { - borderRadius: config("borderRadius.default", ".25rem") - } + '.btn': { + borderRadius: config('borderRadius.default', '.25rem'), + }, }) - } + }, ], - config({ + makeConfig({ borderRadius: { - "1": "1px", - "2": "2px", - "4": "4px", - "8": "8px" - } + '1': '1px', + '2': '2px', + '4': '4px', + '8': '8px', + }, }) ) @@ -628,18 +628,18 @@ test("plugins can provide fallbacks to keys missing from the config", () => { `) }) -test("variants are optional when adding utilities", () => { +test('variants are optional when adding utilities', () => { const { utilities } = processPlugins( [ function({ addUtilities }) { addUtilities({ - ".border-collapse": { - "border-collapse": "collapse" - } + '.border-collapse': { + 'border-collapse': 'collapse', + }, }) - } + }, ], - config() + makeConfig() ) expect(css(utilities)).toMatchCss(` @@ -650,38 +650,38 @@ test("variants are optional when adding utilities", () => { }`) }) -test("plugins can add multiple sets of utilities and components", () => { +test('plugins can add multiple sets of utilities and components', () => { const { components, utilities } = processPlugins( [ function({ addUtilities, addComponents }) { addComponents({ - ".card": { - padding: "1rem", - borderRadius: ".25rem" - } + '.card': { + padding: '1rem', + borderRadius: '.25rem', + }, }) addUtilities({ - ".skew-12deg": { - transform: "skewY(-12deg)" - } + '.skew-12deg': { + transform: 'skewY(-12deg)', + }, }) addComponents({ - ".btn": { - padding: "1rem .5rem", - display: "inline-block" - } + '.btn': { + padding: '1rem .5rem', + display: 'inline-block', + }, }) addUtilities({ - ".border-collapse": { - borderCollapse: "collapse" - } + '.border-collapse': { + borderCollapse: 'collapse', + }, }) - } + }, ], - config() + makeConfig() ) expect(css(utilities)).toMatchCss(` @@ -708,22 +708,22 @@ test("plugins can add multiple sets of utilities and components", () => { `) }) -test("plugins respect prefix and important options by default when adding utilities", () => { +test('plugins respect prefix and important options by default when adding utilities', () => { const { utilities } = processPlugins( [ function({ addUtilities }) { addUtilities({ - ".rotate-90": { - transform: "rotate(90deg)" - } + '.rotate-90': { + transform: 'rotate(90deg)', + }, }) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-", - important: true - } + prefix: 'tw-', + important: true, + }, }) ) @@ -741,16 +741,16 @@ test("component declarations respect the 'prefix' option by default", () => { [ function({ addComponents }) { addComponents({ - ".btn-blue": { - backgroundColor: "blue" - } + '.btn-blue': { + backgroundColor: 'blue', + }, }) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-" - } + prefix: 'tw-', + }, }) ) @@ -767,18 +767,18 @@ test("component declarations can optionally ignore 'prefix' option", () => { function({ addComponents }) { addComponents( { - ".btn-blue": { - backgroundColor: "blue" - } + '.btn-blue': { + backgroundColor: 'blue', + }, }, { respectPrefix: false } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-" - } + prefix: 'tw-', + }, }) ) @@ -794,16 +794,16 @@ test("component declarations are not affected by the 'important' option", () => [ function({ addComponents }) { addComponents({ - ".btn-blue": { - backgroundColor: "blue" - } + '.btn-blue': { + backgroundColor: 'blue', + }, }) - } + }, ], - config({ + makeConfig({ options: { - important: true - } + important: true, + }, }) ) @@ -820,18 +820,18 @@ test("plugins can apply the user's chosen prefix to components manually", () => function({ addComponents, prefix }) { addComponents( { - [prefix(".btn-blue")]: { - backgroundColor: "blue" - } + [prefix('.btn-blue')]: { + backgroundColor: 'blue', + }, }, { respectPrefix: false } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-" - } + prefix: 'tw-', + }, }) ) @@ -842,27 +842,27 @@ test("plugins can apply the user's chosen prefix to components manually", () => `) }) -test("prefix can optionally be ignored for utilities", () => { +test('prefix can optionally be ignored for utilities', () => { const { utilities } = processPlugins( [ function({ addUtilities }) { addUtilities( { - ".rotate-90": { - transform: "rotate(90deg)" - } + '.rotate-90': { + transform: 'rotate(90deg)', + }, }, { - respectPrefix: false + respectPrefix: false, } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-", - important: true - } + prefix: 'tw-', + important: true, + }, }) ) @@ -875,27 +875,27 @@ test("prefix can optionally be ignored for utilities", () => { `) }) -test("important can optionally be ignored for utilities", () => { +test('important can optionally be ignored for utilities', () => { const { utilities } = processPlugins( [ function({ addUtilities }) { addUtilities( { - ".rotate-90": { - transform: "rotate(90deg)" - } + '.rotate-90': { + transform: 'rotate(90deg)', + }, }, { - respectImportant: false + respectImportant: false, } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-", - important: true - } + prefix: 'tw-', + important: true, + }, }) ) @@ -908,29 +908,29 @@ test("important can optionally be ignored for utilities", () => { `) }) -test("variants can still be specified when ignoring prefix and important options", () => { +test('variants can still be specified when ignoring prefix and important options', () => { const { utilities } = processPlugins( [ function({ addUtilities }) { addUtilities( { - ".rotate-90": { - transform: "rotate(90deg)" - } + '.rotate-90': { + transform: 'rotate(90deg)', + }, }, { - variants: ["responsive", "hover", "focus"], + variants: ['responsive', 'hover', 'focus'], respectImportant: false, - respectPrefix: false + respectPrefix: false, } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-", - important: true - } + prefix: 'tw-', + important: true, + }, }) ) @@ -943,24 +943,24 @@ test("variants can still be specified when ignoring prefix and important options `) }) -test("prefix will prefix all classes in a selector", () => { +test('prefix will prefix all classes in a selector', () => { const { components } = processPlugins( [ function({ addComponents, prefix }) { addComponents( { - [prefix(".btn-blue .w-1\\/4 > h1.text-xl + a .bar")]: { - backgroundColor: "blue" - } + [prefix('.btn-blue .w-1\\/4 > h1.text-xl + a .bar')]: { + backgroundColor: 'blue', + }, }, { respectPrefix: false } ) - } + }, ], - config({ + makeConfig({ options: { - prefix: "tw-" - } + prefix: 'tw-', + }, }) ) diff --git a/__tests__/variantsAtRule.test.js b/__tests__/variantsAtRule.test.js index 589d10f76..cce5e2572 100644 --- a/__tests__/variantsAtRule.test.js +++ b/__tests__/variantsAtRule.test.js @@ -4,7 +4,9 @@ import config from '../defaultConfig.stub.js' import processPlugins from '../src/util/processPlugins' function run(input, opts = config) { - return postcss([plugin(opts, processPlugins(opts.plugins, opts))]).process(input, { from: undefined }) + return postcss([plugin(opts, processPlugins(opts.plugins, opts))]).process(input, { + from: undefined, + }) } test('it can generate hover variants', () => { diff --git a/src/defaultPlugins.js b/src/defaultPlugins.js index aebadcb8a..20b7720f7 100644 --- a/src/defaultPlugins.js +++ b/src/defaultPlugins.js @@ -49,7 +49,8 @@ import whitespace from './plugins/whitespace' import width from './plugins/width' import zIndex from './plugins/zIndex' -export default function (config) { +// eslint-disable-next-line complexity +export default function(config) { return [ config.modules.lists === false ? () => {} : lists(), config.modules.appearance === false ? () => {} : appearance(), diff --git a/src/plugins/appearance.js b/src/plugins/appearance.js index e2039eff9..a1cd31b9b 100644 --- a/src/plugins/appearance.js +++ b/src/plugins/appearance.js @@ -1,7 +1,10 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.appearance-none': { appearance: 'none' }, - }, config('modules.appearance')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.appearance-none': { appearance: 'none' }, + }, + config('modules.appearance') + ) } } diff --git a/src/plugins/backgroundAttachment.js b/src/plugins/backgroundAttachment.js index 67f51f1ec..75fc3f4c4 100644 --- a/src/plugins/backgroundAttachment.js +++ b/src/plugins/backgroundAttachment.js @@ -1,9 +1,12 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.bg-fixed': { 'background-attachment': 'fixed' }, - '.bg-local': { 'background-attachment': 'local' }, - '.bg-scroll': { 'background-attachment': 'scroll' }, - }, config('modules.backgroundAttachment')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.bg-fixed': { 'background-attachment': 'fixed' }, + '.bg-local': { 'background-attachment': 'local' }, + '.bg-scroll': { 'background-attachment': 'scroll' }, + }, + config('modules.backgroundAttachment') + ) } } diff --git a/src/plugins/backgroundColors.js b/src/plugins/backgroundColors.js index 767213c92..0d7d47d25 100644 --- a/src/plugins/backgroundColors.js +++ b/src/plugins/backgroundColors.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('backgroundColors'), (value, modifier) => { - return [`.${e(`bg-${modifier}`)}`, { - 'background-color': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('backgroundColors'), (value, modifier) => { + return [ + `.${e(`bg-${modifier}`)}`, + { + 'background-color': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.backgroundColors')) } diff --git a/src/plugins/backgroundPosition.js b/src/plugins/backgroundPosition.js index 517c160dd..3a5144b45 100644 --- a/src/plugins/backgroundPosition.js +++ b/src/plugins/backgroundPosition.js @@ -1,15 +1,18 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.bg-bottom': { 'background-position': 'bottom' }, - '.bg-center': { 'background-position': 'center' }, - '.bg-left': { 'background-position': 'left' }, - '.bg-left-bottom': { 'background-position': 'left bottom' }, - '.bg-left-top': { 'background-position': 'left top' }, - '.bg-right': { 'background-position': 'right' }, - '.bg-right-bottom': { 'background-position': 'right bottom' }, - '.bg-right-top': { 'background-position': 'right top' }, - '.bg-top': { 'background-position': 'top' }, - }, config('modules.backgroundPosition')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.bg-bottom': { 'background-position': 'bottom' }, + '.bg-center': { 'background-position': 'center' }, + '.bg-left': { 'background-position': 'left' }, + '.bg-left-bottom': { 'background-position': 'left bottom' }, + '.bg-left-top': { 'background-position': 'left top' }, + '.bg-right': { 'background-position': 'right' }, + '.bg-right-bottom': { 'background-position': 'right bottom' }, + '.bg-right-top': { 'background-position': 'right top' }, + '.bg-top': { 'background-position': 'top' }, + }, + config('modules.backgroundPosition') + ) } } diff --git a/src/plugins/backgroundRepeat.js b/src/plugins/backgroundRepeat.js index a73f74262..d7f9aac55 100644 --- a/src/plugins/backgroundRepeat.js +++ b/src/plugins/backgroundRepeat.js @@ -1,10 +1,13 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.bg-repeat': { 'background-repeat': 'repeat' }, - '.bg-no-repeat': { 'background-repeat': 'no-repeat' }, - '.bg-repeat-x': { 'background-repeat': 'repeat-x' }, - '.bg-repeat-y': { 'background-repeat': 'repeat-y' }, - }, config('modules.backgroundRepeat')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.bg-repeat': { 'background-repeat': 'repeat' }, + '.bg-no-repeat': { 'background-repeat': 'no-repeat' }, + '.bg-repeat-x': { 'background-repeat': 'repeat-x' }, + '.bg-repeat-y': { 'background-repeat': 'repeat-y' }, + }, + config('modules.backgroundRepeat') + ) } } diff --git a/src/plugins/backgroundSize.js b/src/plugins/backgroundSize.js index 6472dccdd..80bd9eec4 100644 --- a/src/plugins/backgroundSize.js +++ b/src/plugins/backgroundSize.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('backgroundSize'), (value, modifier) => { - return [`.${e(`bg-${modifier}`)}`, { - 'background-size': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('backgroundSize'), (value, modifier) => { + return [ + `.${e(`bg-${modifier}`)}`, + { + 'background-size': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.opacity')) } diff --git a/src/plugins/borderCollapse.js b/src/plugins/borderCollapse.js index a50c7170a..b3e39ca93 100644 --- a/src/plugins/borderCollapse.js +++ b/src/plugins/borderCollapse.js @@ -1,8 +1,11 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.border-collapse': { 'border-collapse': 'collapse' }, - '.border-separate': { 'border-collapse': 'separate' }, - }, config('modules.borderCollapse')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.border-collapse': { 'border-collapse': 'collapse' }, + '.border-separate': { 'border-collapse': 'separate' }, + }, + config('modules.borderCollapse') + ) } } diff --git a/src/plugins/borderColors.js b/src/plugins/borderColors.js index 5157b7c95..251c92963 100644 --- a/src/plugins/borderColors.js +++ b/src/plugins/borderColors.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(_.omit(config('borderColors'), 'default'), (value, modifier) => { - return [`.${e(`border-${modifier}`)}`, { - 'border-color': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(_.omit(config('borderColors'), 'default'), (value, modifier) => { + return [ + `.${e(`border-${modifier}`)}`, + { + 'border-color': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.borderColors')) } diff --git a/src/plugins/borderRadius.js b/src/plugins/borderRadius.js index ebee3b689..05f748465 100644 --- a/src/plugins/borderRadius.js +++ b/src/plugins/borderRadius.js @@ -1,7 +1,7 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { +export default function() { + return function({ addUtilities, config, e }) { const generators = [ (value, modifier) => ({ [`.${e(`rounded${modifier}`)}`]: { borderRadius: `${value}` }, diff --git a/src/plugins/borderStyle.js b/src/plugins/borderStyle.js index 50134739c..120033aec 100644 --- a/src/plugins/borderStyle.js +++ b/src/plugins/borderStyle.js @@ -1,18 +1,21 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.border-solid': { - 'border-style': 'solid', +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.border-solid': { + 'border-style': 'solid', + }, + '.border-dashed': { + 'border-style': 'dashed', + }, + '.border-dotted': { + 'border-style': 'dotted', + }, + '.border-none': { + 'border-style': 'none', + }, }, - '.border-dashed': { - 'border-style': 'dashed', - }, - '.border-dotted': { - 'border-style': 'dotted', - }, - '.border-none': { - 'border-style': 'none', - }, - }, config('modules.borderStyle')) + config('modules.borderStyle') + ) } } diff --git a/src/plugins/borderWidths.js b/src/plugins/borderWidths.js index 58e625e1c..29960705b 100644 --- a/src/plugins/borderWidths.js +++ b/src/plugins/borderWidths.js @@ -1,7 +1,7 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { +export default function() { + return function({ addUtilities, config, e }) { const generators = [ (value, modifier) => ({ [`.${e(`border${modifier}`)}`]: { borderWidth: `${value}` }, diff --git a/src/plugins/cursor.js b/src/plugins/cursor.js index bd5026ee1..aae914fb1 100644 --- a/src/plugins/cursor.js +++ b/src/plugins/cursor.js @@ -1,12 +1,15 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.cursor-auto': { cursor: 'auto' }, - '.cursor-default': { cursor: 'default' }, - '.cursor-pointer': { cursor: 'pointer' }, - '.cursor-wait': { cursor: 'wait' }, - '.cursor-move': { cursor: 'move' }, - '.cursor-not-allowed': { cursor: 'not-allowed' }, - }, config('modules.cursor')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.cursor-auto': { cursor: 'auto' }, + '.cursor-default': { cursor: 'default' }, + '.cursor-pointer': { cursor: 'pointer' }, + '.cursor-wait': { cursor: 'wait' }, + '.cursor-move': { cursor: 'move' }, + '.cursor-not-allowed': { cursor: 'not-allowed' }, + }, + config('modules.cursor') + ) } } diff --git a/src/plugins/display.js b/src/plugins/display.js index a843f0a63..3208ca3c8 100644 --- a/src/plugins/display.js +++ b/src/plugins/display.js @@ -1,27 +1,30 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.block': { - display: 'block', +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.block': { + display: 'block', + }, + '.inline-block': { + display: 'inline-block', + }, + '.inline': { + display: 'inline', + }, + '.table': { + display: 'table', + }, + '.table-row': { + display: 'table-row', + }, + '.table-cell': { + display: 'table-cell', + }, + '.hidden': { + display: 'none', + }, }, - '.inline-block': { - display: 'inline-block', - }, - '.inline': { - display: 'inline', - }, - '.table': { - display: 'table', - }, - '.table-row': { - display: 'table-row', - }, - '.table-cell': { - display: 'table-cell', - }, - '.hidden': { - display: 'none', - }, - }, config('modules.display')) + config('modules.display') + ) } } diff --git a/src/plugins/flexbox.js b/src/plugins/flexbox.js index 79f2e8be3..ef38e2234 100644 --- a/src/plugins/flexbox.js +++ b/src/plugins/flexbox.js @@ -1,117 +1,120 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.flex': { - display: 'flex', +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.flex': { + display: 'flex', + }, + '.inline-flex': { + display: 'inline-flex', + }, + '.flex-row': { + 'flex-direction': 'row', + }, + '.flex-row-reverse': { + 'flex-direction': 'row-reverse', + }, + '.flex-col': { + 'flex-direction': 'column', + }, + '.flex-col-reverse': { + 'flex-direction': 'column-reverse', + }, + '.flex-wrap': { + 'flex-wrap': 'wrap', + }, + '.flex-wrap-reverse': { + 'flex-wrap': 'wrap-reverse', + }, + '.flex-no-wrap': { + 'flex-wrap': 'nowrap', + }, + '.items-start': { + 'align-items': 'flex-start', + }, + '.items-end': { + 'align-items': 'flex-end', + }, + '.items-center': { + 'align-items': 'center', + }, + '.items-baseline': { + 'align-items': 'baseline', + }, + '.items-stretch': { + 'align-items': 'stretch', + }, + '.self-auto': { + 'align-self': 'auto', + }, + '.self-start': { + 'align-self': 'flex-start', + }, + '.self-end': { + 'align-self': 'flex-end', + }, + '.self-center': { + 'align-self': 'center', + }, + '.self-stretch': { + 'align-self': 'stretch', + }, + '.justify-start': { + 'justify-content': 'flex-start', + }, + '.justify-end': { + 'justify-content': 'flex-end', + }, + '.justify-center': { + 'justify-content': 'center', + }, + '.justify-between': { + 'justify-content': 'space-between', + }, + '.justify-around': { + 'justify-content': 'space-around', + }, + '.content-center': { + 'align-content': 'center', + }, + '.content-start': { + 'align-content': 'flex-start', + }, + '.content-end': { + 'align-content': 'flex-end', + }, + '.content-between': { + 'align-content': 'space-between', + }, + '.content-around': { + 'align-content': 'space-around', + }, + '.flex-1': { + flex: '1 1 0%', + }, + '.flex-auto': { + flex: '1 1 auto', + }, + '.flex-initial': { + flex: '0 1 auto', + }, + '.flex-none': { + flex: 'none', + }, + '.flex-grow': { + 'flex-grow': '1', + }, + '.flex-shrink': { + 'flex-shrink': '1', + }, + '.flex-no-grow': { + 'flex-grow': '0', + }, + '.flex-no-shrink': { + 'flex-shrink': '0', + }, }, - '.inline-flex': { - display: 'inline-flex', - }, - '.flex-row': { - 'flex-direction': 'row', - }, - '.flex-row-reverse': { - 'flex-direction': 'row-reverse', - }, - '.flex-col': { - 'flex-direction': 'column', - }, - '.flex-col-reverse': { - 'flex-direction': 'column-reverse', - }, - '.flex-wrap': { - 'flex-wrap': 'wrap', - }, - '.flex-wrap-reverse': { - 'flex-wrap': 'wrap-reverse', - }, - '.flex-no-wrap': { - 'flex-wrap': 'nowrap', - }, - '.items-start': { - 'align-items': 'flex-start', - }, - '.items-end': { - 'align-items': 'flex-end', - }, - '.items-center': { - 'align-items': 'center', - }, - '.items-baseline': { - 'align-items': 'baseline', - }, - '.items-stretch': { - 'align-items': 'stretch', - }, - '.self-auto': { - 'align-self': 'auto', - }, - '.self-start': { - 'align-self': 'flex-start', - }, - '.self-end': { - 'align-self': 'flex-end', - }, - '.self-center': { - 'align-self': 'center', - }, - '.self-stretch': { - 'align-self': 'stretch', - }, - '.justify-start': { - 'justify-content': 'flex-start', - }, - '.justify-end': { - 'justify-content': 'flex-end', - }, - '.justify-center': { - 'justify-content': 'center', - }, - '.justify-between': { - 'justify-content': 'space-between', - }, - '.justify-around': { - 'justify-content': 'space-around', - }, - '.content-center': { - 'align-content': 'center', - }, - '.content-start': { - 'align-content': 'flex-start', - }, - '.content-end': { - 'align-content': 'flex-end', - }, - '.content-between': { - 'align-content': 'space-between', - }, - '.content-around': { - 'align-content': 'space-around', - }, - '.flex-1': { - flex: '1 1 0%', - }, - '.flex-auto': { - flex: '1 1 auto', - }, - '.flex-initial': { - flex: '0 1 auto', - }, - '.flex-none': { - flex: 'none', - }, - '.flex-grow': { - 'flex-grow': '1', - }, - '.flex-shrink': { - 'flex-shrink': '1', - }, - '.flex-no-grow': { - 'flex-grow': '0', - }, - '.flex-no-shrink': { - 'flex-shrink': '0', - }, - }, config('modules.flexbox')) + config('modules.flexbox') + ) } } diff --git a/src/plugins/float.js b/src/plugins/float.js index 7a7eece99..6ae4eb86e 100644 --- a/src/plugins/float.js +++ b/src/plugins/float.js @@ -1,14 +1,17 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.float-right': { float: 'right' }, - '.float-left': { float: 'left' }, - '.float-none': { float: 'none' }, - '.clearfix:after': { - content: '""', - display: 'table', - clear: 'both', - } - }, config('modules.float')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.float-right': { float: 'right' }, + '.float-left': { float: 'left' }, + '.float-none': { float: 'none' }, + '.clearfix:after': { + content: '""', + display: 'table', + clear: 'both', + }, + }, + config('modules.float') + ) } } diff --git a/src/plugins/fontWeights.js b/src/plugins/fontWeights.js index 6d669e973..659956cd2 100644 --- a/src/plugins/fontWeights.js +++ b/src/plugins/fontWeights.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('fontWeights'), (value, modifier) => { - return [`.${e(`font-${modifier}`)}`, { - 'font-weight': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('fontWeights'), (value, modifier) => { + return [ + `.${e(`font-${modifier}`)}`, + { + 'font-weight': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.fontWeights')) } diff --git a/src/plugins/fonts.js b/src/plugins/fonts.js index 25b9efc5e..1cd374d88 100644 --- a/src/plugins/fonts.js +++ b/src/plugins/fonts.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('fonts'), (value, modifier) => { - return [`.${e(`font-${modifier}`)}`, { - 'font-family': _.isArray(value) ? value.join(', ') : value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('fonts'), (value, modifier) => { + return [ + `.${e(`font-${modifier}`)}`, + { + 'font-family': _.isArray(value) ? value.join(', ') : value, + }, + ] + }) + ) addUtilities(utilities, config('modules.fonts')) } diff --git a/src/plugins/height.js b/src/plugins/height.js index 67c0ab745..17d3b6a69 100644 --- a/src/plugins/height.js +++ b/src/plugins/height.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('height'), (value, modifier) => { - return [`.${e(`h-${modifier}`)}`, { - 'height': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('height'), (value, modifier) => { + return [ + `.${e(`h-${modifier}`)}`, + { + height: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.height')) } diff --git a/src/plugins/leading.js b/src/plugins/leading.js index 5dc9a4df0..b1b5c5216 100644 --- a/src/plugins/leading.js +++ b/src/plugins/leading.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('leading'), (value, modifier) => { - return [`.${e(`leading-${modifier}`)}`, { - 'line-height': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('leading'), (value, modifier) => { + return [ + `.${e(`leading-${modifier}`)}`, + { + 'line-height': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.leading')) } diff --git a/src/plugins/lists.js b/src/plugins/lists.js index be5188528..13cb1c786 100644 --- a/src/plugins/lists.js +++ b/src/plugins/lists.js @@ -1,10 +1,13 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.list-reset': { - 'list-style': 'none', - padding: '0', +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.list-reset': { + 'list-style': 'none', + padding: '0', + }, }, - }, config('modules.lists')) + config('modules.lists') + ) } } diff --git a/src/plugins/margin.js b/src/plugins/margin.js index 96737c405..b7c748876 100644 --- a/src/plugins/margin.js +++ b/src/plugins/margin.js @@ -1,7 +1,7 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { +export default function() { + return function({ addUtilities, config, e }) { const generators = [ (size, modifier) => ({ [`.${e(`m-${modifier}`)}`]: { margin: `${size}` }, diff --git a/src/plugins/maxHeight.js b/src/plugins/maxHeight.js index b6f50dcdf..ba1784db6 100644 --- a/src/plugins/maxHeight.js +++ b/src/plugins/maxHeight.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('maxHeight'), (value, modifier) => { - return [`.${e(`max-h-${modifier}`)}`, { - 'max-height': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('maxHeight'), (value, modifier) => { + return [ + `.${e(`max-h-${modifier}`)}`, + { + 'max-height': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.maxHeight')) } diff --git a/src/plugins/maxWidth.js b/src/plugins/maxWidth.js index dadd826ae..ba3798e45 100644 --- a/src/plugins/maxWidth.js +++ b/src/plugins/maxWidth.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('maxWidth'), (value, modifier) => { - return [`.${e(`max-w-${modifier}`)}`, { - 'max-width': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('maxWidth'), (value, modifier) => { + return [ + `.${e(`max-w-${modifier}`)}`, + { + 'max-width': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.maxWidth')) } diff --git a/src/plugins/minHeight.js b/src/plugins/minHeight.js index a094c05a1..6f2966e90 100644 --- a/src/plugins/minHeight.js +++ b/src/plugins/minHeight.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('minHeight'), (value, modifier) => { - return [`.${e(`min-h-${modifier}`)}`, { - 'min-height': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('minHeight'), (value, modifier) => { + return [ + `.${e(`min-h-${modifier}`)}`, + { + 'min-height': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.minHeight')) } diff --git a/src/plugins/minWidth.js b/src/plugins/minWidth.js index a5da08634..bd56df4f3 100644 --- a/src/plugins/minWidth.js +++ b/src/plugins/minWidth.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('minWidth'), (value, modifier) => { - return [`.${e(`min-w-${modifier}`)}`, { - 'min-width': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('minWidth'), (value, modifier) => { + return [ + `.${e(`min-w-${modifier}`)}`, + { + 'min-width': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.minWidth')) } diff --git a/src/plugins/negativeMargin.js b/src/plugins/negativeMargin.js index 1863f978c..e3796f9e9 100644 --- a/src/plugins/negativeMargin.js +++ b/src/plugins/negativeMargin.js @@ -1,7 +1,7 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { +export default function() { + return function({ addUtilities, config, e }) { const generators = [ (size, modifier) => ({ [`.${e(`-m-${modifier}`)}`]: { margin: `${size}` }, diff --git a/src/plugins/objectFit.js b/src/plugins/objectFit.js index 9452858c8..cd0487915 100644 --- a/src/plugins/objectFit.js +++ b/src/plugins/objectFit.js @@ -1,11 +1,14 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.object-contain': { 'object-fit': 'contain' }, - '.object-cover': { 'object-fit': 'cover' }, - '.object-fill': { 'object-fit': 'fill' }, - '.object-none': { 'object-fit': 'none' }, - '.object-scale-down': { 'object-fit': 'scale-down' }, - }, config('modules.objectFit')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.object-contain': { 'object-fit': 'contain' }, + '.object-cover': { 'object-fit': 'cover' }, + '.object-fill': { 'object-fit': 'fill' }, + '.object-none': { 'object-fit': 'none' }, + '.object-scale-down': { 'object-fit': 'scale-down' }, + }, + config('modules.objectFit') + ) } } diff --git a/src/plugins/objectPosition.js b/src/plugins/objectPosition.js index d89830d2d..54af2a1ef 100644 --- a/src/plugins/objectPosition.js +++ b/src/plugins/objectPosition.js @@ -1,15 +1,18 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.object-bottom': { 'object-position': 'bottom' }, - '.object-center': { 'object-position': 'center' }, - '.object-left': { 'object-position': 'left' }, - '.object-left-bottom': { 'object-position': 'left bottom' }, - '.object-left-top': { 'object-position': 'left top' }, - '.object-right': { 'object-position': 'right' }, - '.object-right-bottom': { 'object-position': 'right bottom' }, - '.object-right-top': { 'object-position': 'right top' }, - '.object-top': { 'object-position': 'top' }, - }, config('modules.objectPosition')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.object-bottom': { 'object-position': 'bottom' }, + '.object-center': { 'object-position': 'center' }, + '.object-left': { 'object-position': 'left' }, + '.object-left-bottom': { 'object-position': 'left bottom' }, + '.object-left-top': { 'object-position': 'left top' }, + '.object-right': { 'object-position': 'right' }, + '.object-right-bottom': { 'object-position': 'right bottom' }, + '.object-right-top': { 'object-position': 'right top' }, + '.object-top': { 'object-position': 'top' }, + }, + config('modules.objectPosition') + ) } } diff --git a/src/plugins/opacity.js b/src/plugins/opacity.js index f4dedb7db..68dd37dbb 100644 --- a/src/plugins/opacity.js +++ b/src/plugins/opacity.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('opacity'), (value, modifier) => { - return [`.${e(`opacity-${modifier}`)}`, { - 'opacity': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('opacity'), (value, modifier) => { + return [ + `.${e(`opacity-${modifier}`)}`, + { + opacity: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.opacity')) } diff --git a/src/plugins/outline.js b/src/plugins/outline.js index 79616768f..552f7e511 100644 --- a/src/plugins/outline.js +++ b/src/plugins/outline.js @@ -1,7 +1,10 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.outline-none': { outline: '0' }, - }, config('modules.outline')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.outline-none': { outline: '0' }, + }, + config('modules.outline') + ) } } diff --git a/src/plugins/overflow.js b/src/plugins/overflow.js index 37dd6f2b7..c4faedd66 100644 --- a/src/plugins/overflow.js +++ b/src/plugins/overflow.js @@ -1,20 +1,23 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.overflow-auto': { overflow: 'auto' }, - '.overflow-hidden': { overflow: 'hidden' }, - '.overflow-visible': { overflow: 'visible' }, - '.overflow-scroll': { overflow: 'scroll' }, - '.overflow-x-auto': { 'overflow-x': 'auto' }, - '.overflow-y-auto': { 'overflow-y': 'auto' }, - '.overflow-x-hidden': { 'overflow-x': 'hidden' }, - '.overflow-y-hidden': { 'overflow-y': 'hidden' }, - '.overflow-x-visible': { 'overflow-x': 'visible' }, - '.overflow-y-visible': { 'overflow-y': 'visible' }, - '.overflow-x-scroll': { 'overflow-x': 'scroll' }, - '.overflow-y-scroll': { 'overflow-y': 'scroll' }, - '.scrolling-touch': { '-webkit-overflow-scrolling': 'touch' }, - '.scrolling-auto': { '-webkit-overflow-scrolling': 'auto' }, - }, config('modules.overflow')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.overflow-auto': { overflow: 'auto' }, + '.overflow-hidden': { overflow: 'hidden' }, + '.overflow-visible': { overflow: 'visible' }, + '.overflow-scroll': { overflow: 'scroll' }, + '.overflow-x-auto': { 'overflow-x': 'auto' }, + '.overflow-y-auto': { 'overflow-y': 'auto' }, + '.overflow-x-hidden': { 'overflow-x': 'hidden' }, + '.overflow-y-hidden': { 'overflow-y': 'hidden' }, + '.overflow-x-visible': { 'overflow-x': 'visible' }, + '.overflow-y-visible': { 'overflow-y': 'visible' }, + '.overflow-x-scroll': { 'overflow-x': 'scroll' }, + '.overflow-y-scroll': { 'overflow-y': 'scroll' }, + '.scrolling-touch': { '-webkit-overflow-scrolling': 'touch' }, + '.scrolling-auto': { '-webkit-overflow-scrolling': 'auto' }, + }, + config('modules.overflow') + ) } } diff --git a/src/plugins/padding.js b/src/plugins/padding.js index 85025861f..519604576 100644 --- a/src/plugins/padding.js +++ b/src/plugins/padding.js @@ -1,7 +1,7 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { +export default function() { + return function({ addUtilities, config, e }) { const generators = [ (size, modifier) => ({ [`.${e(`p-${modifier}`)}`]: { padding: `${size}` }, diff --git a/src/plugins/pointerEvents.js b/src/plugins/pointerEvents.js index eb5daaaff..31ee1f8c2 100644 --- a/src/plugins/pointerEvents.js +++ b/src/plugins/pointerEvents.js @@ -1,8 +1,11 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.pointer-events-none': { 'pointer-events': 'none' }, - '.pointer-events-auto': { 'pointer-events': 'auto' }, - }, config('modules.pointerEvents')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.pointer-events-none': { 'pointer-events': 'none' }, + '.pointer-events-auto': { 'pointer-events': 'auto' }, + }, + config('modules.pointerEvents') + ) } } diff --git a/src/plugins/position.js b/src/plugins/position.js index cdc62d073..595235700 100644 --- a/src/plugins/position.js +++ b/src/plugins/position.js @@ -1,29 +1,32 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.static': { position: 'static' }, - '.fixed': { position: 'fixed' }, - '.absolute': { position: 'absolute' }, - '.relative': { position: 'relative' }, - '.sticky': { position: 'sticky' }, - '.pin-none': { - top: 'auto', - right: 'auto', - bottom: 'auto', - left: 'auto', +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.static': { position: 'static' }, + '.fixed': { position: 'fixed' }, + '.absolute': { position: 'absolute' }, + '.relative': { position: 'relative' }, + '.sticky': { position: 'sticky' }, + '.pin-none': { + top: 'auto', + right: 'auto', + bottom: 'auto', + left: 'auto', + }, + '.pin': { + top: 0, + right: 0, + bottom: 0, + left: 0, + }, + '.pin-y': { top: 0, bottom: 0 }, + '.pin-x': { right: 0, left: 0 }, + '.pin-t': { top: 0 }, + '.pin-r': { right: 0 }, + '.pin-b': { bottom: 0 }, + '.pin-l': { left: 0 }, }, - '.pin': { - top: 0, - right: 0, - bottom: 0, - left: 0, - }, - '.pin-y': { top: 0, bottom: 0 }, - '.pin-x': { right: 0, left: 0 }, - '.pin-t': { top: 0 }, - '.pin-r': { right: 0 }, - '.pin-b': { bottom: 0 }, - '.pin-l': { left: 0 }, - }, config('modules.position')) + config('modules.position') + ) } } diff --git a/src/plugins/resize.js b/src/plugins/resize.js index e92bd8bff..362686c05 100644 --- a/src/plugins/resize.js +++ b/src/plugins/resize.js @@ -1,10 +1,13 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.resize-none': { resize: 'none' }, - '.resize-y': { resize: 'vertical' }, - '.resize-x': { resize: 'horizontal' }, - '.resize': { resize: 'both' }, - }, config('modules.resize')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.resize-none': { resize: 'none' }, + '.resize-y': { resize: 'vertical' }, + '.resize-x': { resize: 'horizontal' }, + '.resize': { resize: 'both' }, + }, + config('modules.resize') + ) } } diff --git a/src/plugins/shadows.js b/src/plugins/shadows.js index 9a20bac7c..b19054ed4 100644 --- a/src/plugins/shadows.js +++ b/src/plugins/shadows.js @@ -1,13 +1,18 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('shadows'), (value, modifier) => { - const className = modifier === 'default' ? 'shadow' : `shadow-${modifier}` - return [`.${className}`, { - 'box-shadow': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('shadows'), (value, modifier) => { + const className = modifier === 'default' ? 'shadow' : `shadow-${modifier}` + return [ + `.${e(className)}`, + { + 'box-shadow': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.shadows')) } diff --git a/src/plugins/svgFill.js b/src/plugins/svgFill.js index 8d4f2ac96..f4ccba344 100644 --- a/src/plugins/svgFill.js +++ b/src/plugins/svgFill.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('svgFill'), (value, modifier) => { - return [`.${e(`fill-${modifier}`)}`, { - 'fill': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('svgFill'), (value, modifier) => { + return [ + `.${e(`fill-${modifier}`)}`, + { + fill: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.svgFill')) } diff --git a/src/plugins/svgStroke.js b/src/plugins/svgStroke.js index 9632d7d71..9937cc01f 100644 --- a/src/plugins/svgStroke.js +++ b/src/plugins/svgStroke.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('svgStroke'), (value, modifier) => { - return [`.${e(`stroke-${modifier}`)}`, { - 'stroke': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('svgStroke'), (value, modifier) => { + return [ + `.${e(`stroke-${modifier}`)}`, + { + stroke: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.svgStroke')) } diff --git a/src/plugins/tableLayout.js b/src/plugins/tableLayout.js index 572481b2c..98b090cdd 100644 --- a/src/plugins/tableLayout.js +++ b/src/plugins/tableLayout.js @@ -1,8 +1,11 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.table-auto': { 'table-layout': 'auto' }, - '.table-fixed': { 'table-layout': 'fixed' }, - }, config('modules.tableLayout')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.table-auto': { 'table-layout': 'auto' }, + '.table-fixed': { 'table-layout': 'fixed' }, + }, + config('modules.tableLayout') + ) } } diff --git a/src/plugins/textAlign.js b/src/plugins/textAlign.js index c957c70a3..80ce95c39 100644 --- a/src/plugins/textAlign.js +++ b/src/plugins/textAlign.js @@ -1,10 +1,13 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.text-left': { 'text-align': 'left' }, - '.text-center': { 'text-align': 'center' }, - '.text-right': { 'text-align': 'right' }, - '.text-justify': { 'text-align': 'justify' }, - }, config('modules.textAlign')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.text-left': { 'text-align': 'left' }, + '.text-center': { 'text-align': 'center' }, + '.text-right': { 'text-align': 'right' }, + '.text-justify': { 'text-align': 'justify' }, + }, + config('modules.textAlign') + ) } } diff --git a/src/plugins/textColors.js b/src/plugins/textColors.js index 2ff8d3853..9652313da 100644 --- a/src/plugins/textColors.js +++ b/src/plugins/textColors.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('textColors'), (value, modifier) => { - return [`.${e(`text-${modifier}`)}`, { - 'color': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('textColors'), (value, modifier) => { + return [ + `.${e(`text-${modifier}`)}`, + { + color: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.textColors')) } diff --git a/src/plugins/textSizes.js b/src/plugins/textSizes.js index a09715070..c2f896b90 100644 --- a/src/plugins/textSizes.js +++ b/src/plugins/textSizes.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('textSizes'), (value, modifier) => { - return [`.${e(`text-${modifier}`)}`, { - 'font-size': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('textSizes'), (value, modifier) => { + return [ + `.${e(`text-${modifier}`)}`, + { + 'font-size': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.textSizes')) } diff --git a/src/plugins/textStyle.js b/src/plugins/textStyle.js index f83eb6703..7a0c03bd7 100644 --- a/src/plugins/textStyle.js +++ b/src/plugins/textStyle.js @@ -1,26 +1,29 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.italic': { 'font-style': 'italic' }, - '.roman': { 'font-style': 'normal' }, +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.italic': { 'font-style': 'italic' }, + '.roman': { 'font-style': 'normal' }, - '.uppercase': { 'text-transform': 'uppercase' }, - '.lowercase': { 'text-transform': 'lowercase' }, - '.capitalize': { 'text-transform': 'capitalize' }, - '.normal-case': { 'text-transform': 'none' }, + '.uppercase': { 'text-transform': 'uppercase' }, + '.lowercase': { 'text-transform': 'lowercase' }, + '.capitalize': { 'text-transform': 'capitalize' }, + '.normal-case': { 'text-transform': 'none' }, - '.underline': { 'text-decoration': 'underline' }, - '.line-through': { 'text-decoration': 'line-through' }, - '.no-underline': { 'text-decoration': 'none' }, + '.underline': { 'text-decoration': 'underline' }, + '.line-through': { 'text-decoration': 'line-through' }, + '.no-underline': { 'text-decoration': 'none' }, - '.antialiased': { - '-webkit-font-smoothing': 'antialiased', - '-moz-osx-font-smoothing': 'grayscale', + '.antialiased': { + '-webkit-font-smoothing': 'antialiased', + '-moz-osx-font-smoothing': 'grayscale', + }, + '.subpixel-antialiased': { + '-webkit-font-smoothing': 'auto', + '-moz-osx-font-smoothing': 'auto', + }, }, - '.subpixel-antialiased': { - '-webkit-font-smoothing': 'auto', - '-moz-osx-font-smoothing': 'auto', - }, - }, config('modules.textStyle')) + config('modules.textStyle') + ) } } diff --git a/src/plugins/tracking.js b/src/plugins/tracking.js index 91405c700..1fd6f185c 100644 --- a/src/plugins/tracking.js +++ b/src/plugins/tracking.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config }) { - const utilities = _.fromPairs(_.map(config('tracking'), (value, modifier) => { - return [`.tracking-${modifier}`, { - 'letter-spacing': value, - }] - })) +export default function() { + return function({ addUtilities, config }) { + const utilities = _.fromPairs( + _.map(config('tracking'), (value, modifier) => { + return [ + `.tracking-${modifier}`, + { + 'letter-spacing': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.tracking')) } diff --git a/src/plugins/userSelect.js b/src/plugins/userSelect.js index 0eccdeb36..5fc759c15 100644 --- a/src/plugins/userSelect.js +++ b/src/plugins/userSelect.js @@ -1,8 +1,11 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.select-none': { 'user-select': 'none' }, - '.select-text': { 'user-select': 'text' }, - }, config('modules.userSelect')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.select-none': { 'user-select': 'none' }, + '.select-text': { 'user-select': 'text' }, + }, + config('modules.userSelect') + ) } } diff --git a/src/plugins/verticalAlign.js b/src/plugins/verticalAlign.js index 76a759dbe..374a9da91 100644 --- a/src/plugins/verticalAlign.js +++ b/src/plugins/verticalAlign.js @@ -1,12 +1,15 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.align-baseline': { 'vertical-align': 'baseline' }, - '.align-top': { 'vertical-align': 'top' }, - '.align-middle': { 'vertical-align': 'middle' }, - '.align-bottom': { 'vertical-align': 'bottom' }, - '.align-text-top': { 'vertical-align': 'text-top' }, - '.align-text-bottom': { 'vertical-align': 'text-bottom' }, - }, config('modules.verticalAlign')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.align-baseline': { 'vertical-align': 'baseline' }, + '.align-top': { 'vertical-align': 'top' }, + '.align-middle': { 'vertical-align': 'middle' }, + '.align-bottom': { 'vertical-align': 'bottom' }, + '.align-text-top': { 'vertical-align': 'text-top' }, + '.align-text-bottom': { 'vertical-align': 'text-bottom' }, + }, + config('modules.verticalAlign') + ) } } diff --git a/src/plugins/visibility.js b/src/plugins/visibility.js index dac62c620..9c5061d6e 100644 --- a/src/plugins/visibility.js +++ b/src/plugins/visibility.js @@ -1,8 +1,11 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.visible': { visibility: 'visible' }, - '.invisible': { visibility: 'hidden' }, - }, config('modules.visibility')) +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.visible': { visibility: 'visible' }, + '.invisible': { visibility: 'hidden' }, + }, + config('modules.visibility') + ) } } diff --git a/src/plugins/whitespace.js b/src/plugins/whitespace.js index 42b658836..4f3b2bee4 100644 --- a/src/plugins/whitespace.js +++ b/src/plugins/whitespace.js @@ -1,20 +1,23 @@ -export default function () { - return function ({ addUtilities, config }) { - addUtilities({ - '.whitespace-normal': { 'white-space': 'normal' }, - '.whitespace-no-wrap': { 'white-space': 'nowrap' }, - '.whitespace-pre': { 'white-space': 'pre' }, - '.whitespace-pre-line': { 'white-space': 'pre-line' }, - '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' }, +export default function() { + return function({ addUtilities, config }) { + addUtilities( + { + '.whitespace-normal': { 'white-space': 'normal' }, + '.whitespace-no-wrap': { 'white-space': 'nowrap' }, + '.whitespace-pre': { 'white-space': 'pre' }, + '.whitespace-pre-line': { 'white-space': 'pre-line' }, + '.whitespace-pre-wrap': { 'white-space': 'pre-wrap' }, - '.break-words': { 'word-wrap': 'break-word' }, - '.break-normal': { 'word-wrap': 'normal' }, + '.break-words': { 'word-wrap': 'break-word' }, + '.break-normal': { 'word-wrap': 'normal' }, - '.truncate': { - overflow: 'hidden', - 'text-overflow': 'ellipsis', - 'white-space': 'nowrap', + '.truncate': { + overflow: 'hidden', + 'text-overflow': 'ellipsis', + 'white-space': 'nowrap', + }, }, - }, config('modules.whitespace')) + config('modules.whitespace') + ) } } diff --git a/src/plugins/width.js b/src/plugins/width.js index 517df2340..a83ed16e6 100644 --- a/src/plugins/width.js +++ b/src/plugins/width.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config, e }) { - const utilities = _.fromPairs(_.map(config('width'), (value, modifier) => { - return [`.${e(`w-${modifier}`)}`, { - 'width': value, - }] - })) +export default function() { + return function({ addUtilities, config, e }) { + const utilities = _.fromPairs( + _.map(config('width'), (value, modifier) => { + return [ + `.${e(`w-${modifier}`)}`, + { + width: value, + }, + ] + }) + ) addUtilities(utilities, config('modules.width')) } diff --git a/src/plugins/zIndex.js b/src/plugins/zIndex.js index 68b08991f..31f224b58 100644 --- a/src/plugins/zIndex.js +++ b/src/plugins/zIndex.js @@ -1,12 +1,17 @@ import _ from 'lodash' -export default function () { - return function ({ addUtilities, config }) { - const utilities = _.fromPairs(_.map(config('zIndex'), (value, modifier) => { - return [`.z-${modifier}`, { - 'z-index': value, - }] - })) +export default function() { + return function({ addUtilities, config }) { + const utilities = _.fromPairs( + _.map(config('zIndex'), (value, modifier) => { + return [ + `.z-${modifier}`, + { + 'z-index': value, + }, + ] + }) + ) addUtilities(utilities, config('modules.zIndex')) } diff --git a/src/processTailwindFeatures.js b/src/processTailwindFeatures.js index a3e6f7fe4..8b6af360d 100644 --- a/src/processTailwindFeatures.js +++ b/src/processTailwindFeatures.js @@ -8,28 +8,22 @@ import substituteResponsiveAtRules from './lib/substituteResponsiveAtRules' import substituteScreenAtRules from './lib/substituteScreenAtRules' import substituteClassApplyAtRules from './lib/substituteClassApplyAtRules' -import generateUtilities from './legacy/generateUtilities' import processPlugins from './util/processPlugins' - import defaultPlugins from './defaultPlugins' export default function(getConfig) { return function(css) { const config = getConfig() - const processedPlugins = processPlugins([ - ...defaultPlugins(config), - ...config.plugins - ], config) - const utilities = generateUtilities(config, processedPlugins.utilities) + const processedPlugins = processPlugins([...defaultPlugins(config), ...config.plugins], config) return postcss([ - substituteTailwindAtRules(config, processedPlugins, utilities), + substituteTailwindAtRules(config, processedPlugins, processedPlugins.utilities), evaluateTailwindFunctions(config), substituteVariantsAtRules(config, processedPlugins), substituteResponsiveAtRules(config), substituteScreenAtRules(config), - substituteClassApplyAtRules(config, utilities), - function (root, result) { + substituteClassApplyAtRules(config, processedPlugins.utilities), + function(root) { root.rawCache = { colon: ': ', indent: ' ', @@ -42,7 +36,7 @@ export default function(getConfig) { emptyBody: '', commentLeft: ' ', commentRight: ' ', - semicolon: false + semicolon: false, } }, ]).process(css, { from: _.get(css, 'source.input.file') }) diff --git a/src/utilityModules.js b/src/utilityModules.js index 344b6da17..9859f0797 100644 --- a/src/utilityModules.js +++ b/src/utilityModules.js @@ -1,2 +1 @@ -export default [ -] +export default []