From 76ab2e1205def2f7cf3fe1234bd9c50a7f2046c4 Mon Sep 17 00:00:00 2001 From: Matheus Assis Date: Fri, 5 Mar 2021 15:20:29 -0300 Subject: [PATCH 1/4] fix: fixed caching issue with http-server --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e4a0646..d2862b5 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "check-commit": "npm run type-check && npm run prettier && npm run lint:css && npm run lint:fix && npm run rollup:build", "storybook": "start-storybook -s ./public -p 6006", "build-storybook": "build-storybook -s ./public", - "serve-storybook": "npm run build-storybook && http-server ./storybook-static", + "serve-storybook": "npm run build-storybook && http-server ./storybook-static -c-1", "rollup:build": "rollup -c", "rollup:watch": "rollup -c -w", "prepare": "npm run rollup:build" From 7324a4770a20e73e805d3315b6b9cc391e97915c Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Mon, 8 Mar 2021 09:23:24 -0300 Subject: [PATCH 2/4] fix: fixes an issue with purgecss cleaning up more than it should --- CHANGELOG.md | 2 ++ docs/setup.md | 35 ++++++++++++++++++++++++++++------- package-lock.json | 2 +- postcss.config.js | 3 +++ tailwind.config.js | 3 ++- 5 files changed, 36 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d28759..9f8bcb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue where purgecss was purging more than it needed to + ## [1.4.1] - 2021-03-04 ### Fixed diff --git a/docs/setup.md b/docs/setup.md index 4d5382c..a954ae4 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -38,12 +38,7 @@ You will need: 1. Edit the `tailwind.config.js` file, adding the following `preset`: ```diff module.exports = { - purge: [ - './pages/**/*.{js,ts,jsx,tsx,css}', - './components/**/*.{js,ts,jsx,tsx,css}', - + './node_modules/@perimetre/ui/**/*.{js,ts,jsx,tsx,css}', - + '!./node_modules/@perimetre/ui/**/storybookMappers.tsx' - ], + + purge: false, // Turning tailwindcss purge off because we're customizing the execution order in postcss.config.js darkMode: false, // or 'media' or 'class' theme: { extend: {} @@ -56,7 +51,33 @@ You will need: + presets: [require('@perimetre/ui').defaultPreset] }; ``` -2. [Check out the preset to learn more about the values](../src/presets/default-preset.js) +1. Edit the `postcss.config.js` file, adding the following `preset`: + ```diff + module.exports = { + plugins: { + + 'postcss-import': {}, // Import must come before tailwind + tailwindcss: {}, + + // Other plugins come after tailwind and before postcss-purgecss + autoprefixer + + 'postcss-nested': {}, + + 'postcss-combine-media-query': {}, // Media query must come before duplicated-selectors + + 'postcss-combine-duplicated-selectors': {}, + + // postcss-purgecss should always be last before autoprefixer + + '@fullhuman/postcss-purgecss': { + + content: [ + + // All project components + + './pages/**/*.{js,ts,jsx,tsx,css}', + + './components/**/*.{js,ts,jsx,tsx,css}', + + // Consider the components in the ui + + './node_modules/@perimetre/ui/**/*.{js,ts,jsx,tsx,css}', + + '!./node_modules/@perimetre/ui/**/storybookMappers.tsx' // ignore the storybookMappers.tsx inside @perimetre/ui because that should only be used by the ui package itself + + ] + + }, + + // autoprefixer should always be the last one + autoprefixer: {} + } + }; + ``` +1. [Check out the preset to learn more about the values](../src/presets/default-preset.js) ### Importing the font diff --git a/package-lock.json b/package-lock.json index 7203336..6bf8de0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@perimetre/ui", - "version": "1.4.0", + "version": "1.4.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/postcss.config.js b/postcss.config.js index 1cddf56..1be095f 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -6,6 +6,9 @@ module.exports = { 'postcss-nested': {}, 'postcss-combine-media-query': {}, // Media query must come before duplicated-selectors 'postcss-combine-duplicated-selectors': {}, + '@fullhuman/postcss-purgecss': { + content: ['./src/**/*.{js,ts,jsx,tsx,css}', './.storybook/**/*.{js,ts,jsx,tsx,css}'] + }, autoprefixer: {} } }; diff --git a/tailwind.config.js b/tailwind.config.js index 9852d50..892cbbd 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,6 +1,7 @@ // Ref: https://tailwindcss.com/docs/configuration + module.exports = { - purge: ['./src/**/*.{js,ts,jsx,tsx,css}', './.storybook/**/*.{js,ts,jsx,tsx,css}'], + purge: false, darkMode: false, // or 'media' or 'class' presets: [require('./src/presets/default-preset')] }; From f804fb9d571541d079301aa1529db2e26d9b6cb0 Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Mon, 8 Mar 2021 09:35:51 -0300 Subject: [PATCH 3/4] fix: fixed text-align toggle in WYSIWYGInput --- CHANGELOG.md | 1 + src/utils/wysiwyg.tsx | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f8bcb3..1726cff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Fixed an issue where purgecss was purging more than it needed to +- Fixed a bug where the WYSIWYGInput text align buttons were not toggling correctly when switching from an alignment to another ## [1.4.1] - 2021-03-04 diff --git a/src/utils/wysiwyg.tsx b/src/utils/wysiwyg.tsx index 1b1fffc..d02a09f 100644 --- a/src/utils/wysiwyg.tsx +++ b/src/utils/wysiwyg.tsx @@ -56,8 +56,9 @@ export const toggleBlockData = async ( // For each entry in the provided data object Object.entries(data || {}).forEach(([key, value]) => { // If the current data DOES NOT have the key - if (!currentData.has(key)) { - // Add the key to the new data, because we should keep ip + // Of if there is but the value is a different one, we then want to update the value + if (!currentData.has(key) || currentData.get(key) !== value) { + // Add the key to the new data, because we should keep it newData[key] = value; } From a9c385fd261db8070538474806e42f5c0e71d6ba Mon Sep 17 00:00:00 2001 From: AssisrMatheus Date: Mon, 8 Mar 2021 09:38:21 -0300 Subject: [PATCH 4/4] build: bumping version 1.4.2 --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1726cff..0521f5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +## [1.4.2] - 2021-03-08 + +### Fixed + - Fixed an issue where purgecss was purging more than it needed to - Fixed a bug where the WYSIWYGInput text align buttons were not toggling correctly when switching from an alignment to another diff --git a/package.json b/package.json index d2862b5..7817816 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@perimetre/ui", "description": "A component library made by @perimetre", - "version": "1.4.1", + "version": "1.4.2", "repository": { "type": "git", "url": "git+https://github.com/perimetre/ui.git"