From fbeadb76cc8f8dd0c5dcf60b2341549e2c179e2e Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Wed, 9 Jan 2019 13:12:28 -0500 Subject: [PATCH] Port textAlign module to plugin --- src/defaultPlugins.js | 2 ++ src/generators/textAlign.js | 10 ---------- src/plugins/textAlign.js | 10 ++++++++++ src/utilityModules.js | 2 -- 4 files changed, 12 insertions(+), 12 deletions(-) delete mode 100644 src/generators/textAlign.js create mode 100644 src/plugins/textAlign.js diff --git a/src/defaultPlugins.js b/src/defaultPlugins.js index 05e66081c..9f9d7a927 100644 --- a/src/defaultPlugins.js +++ b/src/defaultPlugins.js @@ -1,3 +1,4 @@ +import textAlign from './plugins/textAlign' import textColors from './plugins/textColors' import textSizes from './plugins/textSizes' import textStyle from './plugins/textStyle' @@ -10,6 +11,7 @@ import width from './plugins/width' import zIndex from './plugins/zIndex' export default [ + textAlign(), textColors(), textSizes(), textStyle(), diff --git a/src/generators/textAlign.js b/src/generators/textAlign.js deleted file mode 100644 index e1b29f279..000000000 --- a/src/generators/textAlign.js +++ /dev/null @@ -1,10 +0,0 @@ -import defineClasses from '../util/defineClasses' - -export default function() { - return defineClasses({ - 'text-left': { 'text-align': 'left' }, - 'text-center': { 'text-align': 'center' }, - 'text-right': { 'text-align': 'right' }, - 'text-justify': { 'text-align': 'justify' }, - }) -} diff --git a/src/plugins/textAlign.js b/src/plugins/textAlign.js new file mode 100644 index 000000000..c957c70a3 --- /dev/null +++ b/src/plugins/textAlign.js @@ -0,0 +1,10 @@ +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/utilityModules.js b/src/utilityModules.js index 026430db1..1e37ad346 100644 --- a/src/utilityModules.js +++ b/src/utilityModules.js @@ -37,7 +37,6 @@ import shadows from './generators/shadows' import svgFill from './generators/svgFill' import svgStroke from './generators/svgStroke' import tableLayout from './generators/tableLayout' -import textAlign from './generators/textAlign' export default [ { name: 'lists', generator: lists }, @@ -79,5 +78,4 @@ export default [ { name: 'svgFill', generator: svgFill }, { name: 'svgStroke', generator: svgStroke }, { name: 'tableLayout', generator: tableLayout }, - { name: 'textAlign', generator: textAlign }, ]