From 6f09c179a352af6b2ea71887928a72ff3f46cf34 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Thu, 17 Dec 2020 22:03:55 +0300 Subject: [PATCH 1/5] Add Vocabulary Select implementation instead of buefy select --- src/App.vue | 3 +- src/Vocabulary/VSelect.vue | 80 +++++++++++++++++++++++++++++++++ src/components/DropdownStep.vue | 36 +++++++-------- 3 files changed, 97 insertions(+), 22 deletions(-) create mode 100644 src/Vocabulary/VSelect.vue diff --git a/src/App.vue b/src/App.vue index 898e500c8..fa57a3652 100644 --- a/src/App.vue +++ b/src/App.vue @@ -140,11 +140,10 @@ export default { @import "~bulma"; @import '~buefy/src/scss/utils/_variables.scss'; @import '~buefy/src/scss/components/_modal.scss'; - @import '~buefy/src/scss/components/_select.scss'; @import '~buefy/src/scss/components/_form.scss'; @import '~buefy/src/scss/components/_icon.scss'; - @import "@creativecommons/vocabulary/scss/vocabulary.scss"; + @import "~@creativecommons/vocabulary/scss/vocabulary.scss"; #app { -webkit-font-smoothing: antialiased; diff --git a/src/Vocabulary/VSelect.vue b/src/Vocabulary/VSelect.vue new file mode 100644 index 000000000..b93b4b5f1 --- /dev/null +++ b/src/Vocabulary/VSelect.vue @@ -0,0 +1,80 @@ + + + diff --git a/src/components/DropdownStep.vue b/src/components/DropdownStep.vue index 239919a85..bf8dd1e0d 100644 --- a/src/components/DropdownStep.vue +++ b/src/components/DropdownStep.vue @@ -1,33 +1,29 @@ diff --git a/src/components/DropdownStep.vue b/src/components/DropdownStep.vue index bf8dd1e0d..239919a85 100644 --- a/src/components/DropdownStep.vue +++ b/src/components/DropdownStep.vue @@ -1,29 +1,33 @@ import { mapGetters } from 'vuex' -import VSelect from '@/Vocabulary/VSelect' export default { name: 'DropdownStep', - components: { VSelect }, - inheritAttrs: false, props: { + status: { + type: String, + validator(value) { + return ['active', 'previous', 'inactive'].includes(value) + } + }, id: Number }, data() { From c91767450ff97d11383e797708e9dcdae215c08d Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Tue, 5 Jan 2021 17:42:31 +0300 Subject: [PATCH 3/5] Add postcss to purge unused css --- package-lock.json | 161 +++++++++++++++++++++++-------- package.json | 1 + postcss.config.js | 40 ++++++++ src/components/HeaderSection.vue | 73 ++++++++------ 4 files changed, 207 insertions(+), 68 deletions(-) create mode 100644 postcss.config.js diff --git a/package-lock.json b/package-lock.json index 4ef5c87d1..d4c971b84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1163,6 +1163,14 @@ } } }, + "@fullhuman/postcss-purgecss": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@fullhuman/postcss-purgecss/-/postcss-purgecss-3.1.3.tgz", + "integrity": "sha512-kwOXw8fZ0Lt1QmeOOrd+o4Ibvp4UTEBFQbzvWldjlKv5n+G9sXfIPn1hh63IQIL8K8vbvv1oYMJiIUbuy9bGaA==", + "requires": { + "purgecss": "^3.1.3" + } + }, "@hapi/address": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/@hapi/address/-/address-2.1.4.tgz", @@ -2496,17 +2504,6 @@ "unique-filename": "^1.1.1" } }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", - "dev": true, - "optional": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, "chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", @@ -2684,18 +2681,6 @@ "webpack-sources": "^1.4.3" } }, - "vue-loader-v16": { - "version": "npm:vue-loader@16.1.2", - "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz", - "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==", - "dev": true, - "optional": true, - "requires": { - "chalk": "^4.1.0", - "hash-sum": "^2.0.0", - "loader-utils": "^2.0.0" - } - }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -3539,10 +3524,9 @@ "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" }, "axios": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.0.tgz", - "integrity": "sha512-fmkJBknJKoZwem3/IKSSLpkdNXZeBu5Q7GA/aRsr2btgrptmSCxi2oFjZHqGdK9DoTil9PIHlPIZw2EcRJXRvw==", - "dev": true, + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "requires": { "follow-redirects": "^1.10.0" } @@ -5364,8 +5348,7 @@ "colorette": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.1.tgz", - "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==", - "dev": true + "integrity": "sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw==" }, "combined-stream": { "version": "1.0.8", @@ -6032,8 +6015,7 @@ "cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", - "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", - "dev": true + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==" }, "cssnano": { "version": "4.1.10", @@ -8485,8 +8467,7 @@ "follow-redirects": { "version": "1.13.1", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", - "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==", - "dev": true + "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" }, "for-in": { "version": "1.0.2", @@ -9526,8 +9507,7 @@ "indexes-of": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/indexes-of/-/indexes-of-1.0.1.tgz", - "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=", - "dev": true + "integrity": "sha1-8w9xbI4r00bHtn0985FVZqfAVgc=" }, "infer-owner": { "version": "1.0.4", @@ -14519,7 +14499,6 @@ "version": "6.0.4", "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.4.tgz", "integrity": "sha512-gjMeXBempyInaBqpp8gODmwZ52WaYsVOsfr4L4lDQ7n3ncD6mEyySiDtgzCT+NYC0mmeOLvtsF8iaEf0YT6dBw==", - "dev": true, "requires": { "cssesc": "^3.0.0", "indexes-of": "^1.0.1", @@ -14808,6 +14787,44 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, + "purgecss": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-3.1.3.tgz", + "integrity": "sha512-hRSLN9mguJ2lzlIQtW4qmPS2kh6oMnA9RxdIYK8sz18QYqd6ePp4GNDl18oWHA1f2v2NEQIh51CO8s/E3YGckQ==", + "requires": { + "commander": "^6.0.0", + "glob": "^7.0.0", + "postcss": "^8.2.1", + "postcss-selector-parser": "^6.0.2" + }, + "dependencies": { + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" + }, + "nanoid": { + "version": "3.1.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", + "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==" + }, + "postcss": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.2.2.tgz", + "integrity": "sha512-HM1NDNWLgglJPQQMNwvLxgH2KcrKZklKLi/xXYIOaqQB57p/pDWEJNS83PVICYsn1Dg/9C26TiejNr422/ePaQ==", + "requires": { + "colorette": "^1.2.1", + "nanoid": "^3.1.20", + "source-map": "^0.6.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, "q": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz", @@ -17248,8 +17265,7 @@ "uniq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", - "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=", - "dev": true + "integrity": "sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8=" }, "uniqs": { "version": "2.0.0", @@ -17803,6 +17819,75 @@ } } }, + "vue-loader-v16": { + "version": "npm:vue-loader@16.1.2", + "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-16.1.2.tgz", + "integrity": "sha512-8QTxh+Fd+HB6fiL52iEVLKqE9N1JSlMXLR92Ijm6g8PZrwIxckgpqjPDWRP5TWxdiPaHR+alUWsnu1ShQOwt+Q==", + "dev": true, + "optional": true, + "requires": { + "chalk": "^4.1.0", + "hash-sum": "^2.0.0", + "loader-utils": "^2.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "optional": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "dev": true, + "optional": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "optional": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "optional": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "optional": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "optional": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "vue-scrollto": { "version": "2.20.0", "resolved": "https://registry.npmjs.org/vue-scrollto/-/vue-scrollto-2.20.0.tgz", diff --git a/package.json b/package.json index 86fed04ef..531f78b86 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "dependencies": { "@creativecommons/vocabulary": "^2020.11.3", "@creativecommons/vue-vocabulary": "^2020.11.3", + "@fullhuman/postcss-purgecss": "^3.1.3", "@linusborg/vue-simple-portal": "^0.1.4", "@sentry/browser": "^5.20.1", "@sentry/integrations": "^5.20.1", diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 000000000..1749815aa --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,40 @@ +const IN_PRODUCTION = process.env.NODE_ENV === 'production' + +module.exports = { + plugins: [ + IN_PRODUCTION && + require('@fullhuman/postcss-purgecss')({ + content: ['./public/**/*.html', './src/**/*.vue'], + defaultExtractor(content) { + const contentWithoutStyleBlocks = content.replace( + /<\/style>/gi, + '' + ) + return ( + contentWithoutStyleBlocks.match( + /[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g + ) || [] + ) + }, + safelist: [ + /-(leave|enter|appear)(|-(to|from|active))$/, + /^(?!(|.*?:)cursor-move).+-move$/, + /^router-link(|-exact)-active$/, + /data-v-.*/, + /is-text/, + /control/, + /select/, + /^tabs.*/, + /is-boxed/, + /app-modal/, + /overlay/, + /^modal.*/, + /padding.*/, + /icon/, + /close-button/, + /has-color-gray/, + /is-size-.*/ + ] + }) + ] +} diff --git a/src/components/HeaderSection.vue b/src/components/HeaderSection.vue index 8300d19f1..cd8545fee 100644 --- a/src/components/HeaderSection.vue +++ b/src/components/HeaderSection.vue @@ -1,29 +1,44 @@ @@ -39,15 +54,13 @@ export default { .navbar-burger { background-color:white; } -.navbar-item-feedback { - padding-right: 30%; - font-family: Roboto Condensed,sans-serif; - font-size: 16px; +.navbar-item.navbar-item-feedback { + font-size: 1rem; font-weight: bold; - color: #787878!important; + color: #787878; transition: color 300ms ease; &:hover { - color: #fb7729!important; + color: #fb7729; background-color: white; } } From 792943a505d65bf386cf7fe5d8df6ac2fbb611e6 Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Tue, 5 Jan 2021 18:28:48 +0300 Subject: [PATCH 4/5] Make text inside modals correct color --- src/components/HelpSection.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/HelpSection.vue b/src/components/HelpSection.vue index d2adb388c..361d6eee7 100644 --- a/src/components/HelpSection.vue +++ b/src/components/HelpSection.vue @@ -283,6 +283,7 @@ export default { padding-top: var(--h-padding); padding-bottom: var(--h-padding); margin: 0; + color: #333333; article { max-width: 85ch; From 48d188f65dfdfad9e611aa6991329bd01fb7829f Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Wed, 6 Jan 2021 11:53:06 +0300 Subject: [PATCH 5/5] Document whitelisting classes in PurgeCSS PostCSS plugin --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 899aa8163..529c51002 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ For information on contributing, please see [Creative Commons' Contribution Guid If you create a PR for your work, but you are not finished yet, please include `WIP:` in the beginning of your PR title. When your work on your PR is completed and you are ready for a final review, please remove the `WIP:` prefix from the title to indicate that your work is done. -Here's a [handy link](https://github.com/creativecommons/chooser/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22+-label%3A%22in+progress%22) that will show you all open issues in this repo that have the `help wanted` tag, but do not have the `in progress` tag. -All issues in this list are up for grabs! +Here's a [handy link](https://github.com/creativecommons/chooser/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22+-label%3A%22in+progress%22) that will show you all open issues in this repo that have the `help wanted` tag, but do not have the `in progress` tag. +All issues in this list are up for grabs! If it says "No results matched your search", then there are no issues currently up for grabs. *If no progress has been made on an issue for seven days after assignment, the assignment will be removed to allow others to contribute.* @@ -42,8 +42,10 @@ $ npm run test ``` To run e2e tests, you must have Java installed. [[download Java here](https://java.com/download/)] +## CSS Build +The Chooser uses PostCSS plugin for PurgeCSS to make CSS bundle size smaller. It automatically removes unused CSS based on the classes found in the final built bundle. Some styles for dynamic components or dynamically-imported files can also be removed. If you find that the built site misses some styles, you can manually add the necessary classes or Regex expressions to the `safelist` array in the `postcss.config.js` file. ## Deployment -The chooser is deployed to GitHub Pages. The source files for the beta deployment are contained in the `./docs/` dir, and are live. Any changes to this dir's contents will be automatically deployed, so please take care when making modifications to this location. +The chooser is deployed to GitHub Pages. The source files for the beta deployment are contained in the `./docs/` dir, and are live. Any changes to this dir's contents will be automatically deployed, so please take care when making modifications to this location. -To update the dist bundle, run ```$ npm run build```, and copy the generated files from `./dist/` to `./docs/`, taking care to not delete the CNAME file in `./docs/`. +To update the dist bundle, run ```$ npm run build```. This and copy the generated files from `./dist/` to `./docs/`, taking care to not delete the CNAME file in `./docs/`.