Skip to content

Commit

Permalink
Merge pull request #6 from hacknug/master
Browse files Browse the repository at this point in the history
Fix plugin breaking when config is empty
  • Loading branch information
oxyc authored Sep 27, 2019
2 parents 703b35d + 1dde0a7 commit 55a46ad
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
package-lock.json
pnpm-lock.yaml
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"url": "git://github.com/genero/tailwindcss-gutenberg.git"
},
"devDependencies": {
"eslint": "^5.0.0"
"eslint": "^6.4.0"
},
"dependencies": {
"chroma-js": "^2.0.3"
Expand Down
2 changes: 1 addition & 1 deletion plugins/alignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const alignmentStyling = (className, options) => {
};

module.exports = ({ addComponents, theme }) => {
const { alignwide, alignfull, alignleftright, ...defaults } = theme('gutenberg.alignments');
const { alignwide, alignfull, alignleftright, ...defaults } = theme('gutenberg.alignments', {});
const backgroundGutter = defaults.backgroundGutter || '30px';

if (alignwide) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/colors.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = ({ addUtilities, theme, e }) => {
const colors = theme('gutenberg.colors');
const colors = theme('gutenberg.colors', {});
const utilities = {};

for (let [slug, color] of Object.entries(colors)) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/fontsizes.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = ({ addUtilities, theme, e }) => {
const fontsizes = theme('gutenberg.fontSizes');
const fontsizes = theme('gutenberg.fontSizes', {});
const utilities = {};

for (let [slug, fontSize] of Object.entries(fontsizes)) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/foregroundColors.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const pickHighestContrastColor = (foregroundColors, background) => {

module.exports = ({ addComponents, theme, e }) => {
const components = {};
const colors = theme('gutenberg.colors')
const foregroundColors = theme('gutenberg.foregroundColors') || ['#000000', '#ffffff'];
const colors = theme('gutenberg.colors', {})
const foregroundColors = theme('gutenberg.foregroundColors', ['#000000', '#ffffff']);

for (let [slug, color] of Object.entries(colors)) {
// pick a default text color with highest contrast.
Expand Down

0 comments on commit 55a46ad

Please sign in to comment.