diff --git a/src/defaultPlugins.js b/src/defaultPlugins.js index d7b6333d7..97da2fe3c 100644 --- a/src/defaultPlugins.js +++ b/src/defaultPlugins.js @@ -1,3 +1,4 @@ +import backgroundAttachment from './plugins/backgroundAttachment' import backgroundColors from './plugins/backgroundColors' import backgroundPosition from './plugins/backgroundPosition' import backgroundRepeat from './plugins/backgroundRepeat' @@ -48,6 +49,7 @@ import zIndex from './plugins/zIndex' export default function (config) { return [ + config.modules.backgroundAttachment === false ? () => {} : backgroundAttachment(), config.modules.backgroundColors === false ? () => {} : backgroundColors(), config.modules.backgroundPosition === false ? () => {} : backgroundPosition(), config.modules.backgroundRepeat === false ? () => {} : backgroundRepeat(), diff --git a/src/generators/backgroundAttachment.js b/src/generators/backgroundAttachment.js deleted file mode 100644 index 04e77c459..000000000 --- a/src/generators/backgroundAttachment.js +++ /dev/null @@ -1,9 +0,0 @@ -import defineClasses from '../util/defineClasses' - -export default function() { - return defineClasses({ - 'bg-fixed': { 'background-attachment': 'fixed' }, - 'bg-local': { 'background-attachment': 'local' }, - 'bg-scroll': { 'background-attachment': 'scroll' }, - }) -} diff --git a/src/plugins/backgroundAttachment.js b/src/plugins/backgroundAttachment.js new file mode 100644 index 000000000..67f51f1ec --- /dev/null +++ b/src/plugins/backgroundAttachment.js @@ -0,0 +1,9 @@ +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/utilityModules.js b/src/utilityModules.js index 880f4a904..c4bfdfa61 100644 --- a/src/utilityModules.js +++ b/src/utilityModules.js @@ -1,9 +1,7 @@ import lists from './generators/lists' import appearance from './generators/appearance' -import backgroundAttachment from './generators/backgroundAttachment' export default [ { name: 'lists', generator: lists }, { name: 'appearance', generator: appearance }, - { name: 'backgroundAttachment', generator: backgroundAttachment }, ]