From b4e901c1974e4ecbf37483e6efa82bb87e5b5c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorien=20Gr=C3=B6nwald?= Date: Mon, 13 May 2024 11:53:49 +0200 Subject: [PATCH 1/8] chore: update github workflow --- .github/workflows/tests.yml | 8 +++++--- composer.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ccee483..2944fd1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,12 +13,14 @@ jobs: strategy: fail-fast: false matrix: - php: [8.2, 8.1, 8.0, 7.4] - laravel: [10.*, 9.*, 8.*] - statamic: [4.*, 3.*] + php: [8.3, 8.2, 8.1, 8.0, 7.4] + laravel: [11.*, 10.*, 9.*, 8.*] + statamic: [5.*, 4.*, 3.*] dependency-version: [prefer-stable] os: [ubuntu-latest] include: + - laravel: 11.* + testbench: 8.* - laravel: 10.* testbench: 8.* - laravel: 9.* diff --git a/composer.json b/composer.json index 7f67c17..761c311 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "visuellverstehen/statamic-classify", "description": "A useful helper to add CSS classes to all HTML tags generated by the bard editor.", - "keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v3", "v4" ], + "keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v3", "v4", "v5" ], "license": "proprietary", "type": "statamic-addon", "autoload": { From 342e4bf0029785d5e50093427c0148b7a0223fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorien=20Gr=C3=B6nwald?= Date: Mon, 13 May 2024 12:07:13 +0200 Subject: [PATCH 2/8] chore: update README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ba0f210..576894c 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ Classify is a useful helper to add CSS classes to all HTML tags generated by the ## Requirements -- Statamic v3 || v4 -- Laravel 9 || 10 +- Statamic v3 || v4 || v5 +- Laravel 9 || 10 || 11 - PHP 8 ### Version compatibility From 6375cf8125ed676c53db3059c50ade02baf4f86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorien=20Gr=C3=B6nwald?= Date: Mon, 13 May 2024 12:10:36 +0200 Subject: [PATCH 3/8] chore: add badge for statamic 5 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 576894c..f4a0945 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ [![Statamic 3](https://img.shields.io/badge/Statamic-v3-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) [![Statamic 4](https://img.shields.io/badge/Statamic-v4-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) +[![Statamic 5](https://img.shields.io/badge/Statamic-v5-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) [![Latest version on Packagist](https://img.shields.io/packagist/v/visuellverstehen/statamic-classify.svg?style=for-the-badge)](https://packagist.org/packages/visuellverstehen/statamic-classify) # Classify From 6ada0258af1152b517c6954618ed1dca88b875d3 Mon Sep 17 00:00:00 2001 From: Julia Lange <44929138+juliawarnke@users.noreply.github.com> Date: Mon, 13 May 2024 16:08:09 +0200 Subject: [PATCH 4/8] drop support for statamic 3, laravel 8 and 9 plus php 8.1 and lower --- .github/workflows/tests.yml | 29 +++++++++-------------------- README.md | 20 +++----------------- composer.json | 12 ++++++------ 3 files changed, 18 insertions(+), 43 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2944fd1..1f4917c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,31 +13,20 @@ jobs: strategy: fail-fast: false matrix: - php: [8.3, 8.2, 8.1, 8.0, 7.4] - laravel: [11.*, 10.*, 9.*, 8.*] - statamic: [5.*, 4.*, 3.*] - dependency-version: [prefer-stable] - os: [ubuntu-latest] + os: [ubuntu-latest] + php: [8.3, 8.2] + laravel: [11.*, 10.*] + statamic: [5.*, 4.*] + dependency-version: [prefer-lowest, prefer-stable] include: - laravel: 11.* - testbench: 8.* + framework: ^11.0 + testbench: 9.* - laravel: 10.* + framework: ^10.0 testbench: 8.* - - laravel: 9.* - testbench: 7.* - - laravel: 8.* - testbench: 6.* - exclude: - - laravel: 9.* - statamic: ^3.2 - - laravel: 9.* - php: 7.4 - - laravel: 10.* - php: 8.0 - - laravel: 10.* - php: 7.4 - name: P${{ matrix.php }} - S${{ matrix.statamic }} - L${{ matrix.laravel }} + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ubuntu-latest steps: - name: Checkout code diff --git a/README.md b/README.md index f4a0945..75ae1c1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Statamic 3](https://img.shields.io/badge/Statamic-v3-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) [![Statamic 4](https://img.shields.io/badge/Statamic-v4-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) [![Statamic 5](https://img.shields.io/badge/Statamic-v5-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify) [![Latest version on Packagist](https://img.shields.io/packagist/v/visuellverstehen/statamic-classify.svg?style=for-the-badge)](https://packagist.org/packages/visuellverstehen/statamic-classify) @@ -10,22 +9,9 @@ Classify is a useful helper to add CSS classes to all HTML tags generated by the ## Requirements -- Statamic v3 || v4 || v5 -- Laravel 9 || 10 || 11 -- PHP 8 - -### Version compatibility - -| Classify | Statamic | Laravel -|:----------|:----------------|:--------- -| ^1.0 | 3.0 | ^7.0 -| ^2.0 | 3.0 | ^8.0 -| ^2.1 | 3.1 | ^8.0 -| ^2.2 | 3.1 | ^8.0 -| ^2.3 | 3.2 | ^8.0 -| ^2.4 | ^3.0 | ^9.0 -| ^2.5 | ^3.0 \|\| ^4.0 | ^9.0 -| ^2.6 | ^3.0 \|\| ^4.0 | ^9.0 \|\| ^10.0 +- Statamic v4 || v5 +- Laravel 10 || 11 +- PHP 8.2 ## Installation diff --git a/composer.json b/composer.json index 761c311..0a398c1 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "visuellverstehen/statamic-classify", "description": "A useful helper to add CSS classes to all HTML tags generated by the bard editor.", - "keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v3", "v4", "v5" ], + "keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v4", "v5" ], "license": "proprietary", "type": "statamic-addon", "autoload": { @@ -23,14 +23,14 @@ "email": "hello@visuellverstehen.de" }, "require": { - "php": "^7.4 || ^8.0", - "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "statamic/cms": "^3.0.38 || ^4.0 || ^5.0", - "symfony/dom-crawler": "^5.4 || ^6.0", + "php": "^8.2 || ^8.3", + "laravel/framework": "^10.0 || ^11.0", + "statamic/cms": "^4.0 || ^5.0", + "symfony/dom-crawler": "^6.0", "symfony/css-selector": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "orchestra/testbench": "^6.0 || ^7.0 || ^8 || ^9", + "orchestra/testbench": "^8 || ^9", "phpunit/phpunit": "^9.3 || ^10.0" }, "scripts": { From fc6a7f683bed6d4284ac679a67471a11b0712b38 Mon Sep 17 00:00:00 2001 From: Simon Schweissinger Date: Wed, 22 May 2024 14:39:23 +0200 Subject: [PATCH 5/8] chore: update readme --- README.md | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 75ae1c1..f4e6f98 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,7 @@ Classify is a useful helper to add CSS classes to all HTML tags generated by the - Statamic v4 || v5 - Laravel 10 || 11 -- PHP 8.2 - +- PHP 8.2+ ## Installation @@ -61,7 +60,7 @@ If you want to use the default style set, use the `classify` modifier. {{ bard_text | classify }} ``` -If you want to add multiple style sets, define those in the config file. For example: +If you want to add multiple style sets, you can define those in the config file: ```php 'default' => [ // @@ -88,23 +87,21 @@ If you want to get the defined classes for a certain element, you can get them s // output: link hover:underline ``` -## Nested selectors (min version 2.2) -You can nest your selectors to flexible style elements in different contexts. +## Nested selectors +You can nest your selectors to style elements differently in varying contexts. + +Let's assume you want to style links inside lists differently to a general link, you can make use of nesting: -Let's assume you want to style links inside lists differently than a general link, you can make use of nesting: ```php `ul li p a` => 'my-secial-css-class-for-nested-links-in-lists`, `a` => `a-general-link-class`, ``` -The order doesn't matter. Classify will take care of that for you. +Classify will take care of the order, so you don't need to define the nested selector before the general selector. ## Working with CSS frameworks (like TailwindCSS) -Some CSS frameworks utilize JIT compiling, or have some other means of purging CSS classes from production builds to reduce file sizes. - -Make sure to include your CSS classes as content, so TailwindCSS can include those in the compiled file. This is important, as your -classify CSS classes may not be in your template files, as they will be added dynamically. +Some CSS frameworks utilize JIT compiling, or have some other means of purging CSS classes from production builds to reduce file size. Your classify CSS classes may not appear anywhere else in your template files, as they will be added dynamically. To make sure that your classes will be considered for compiling, you have to include the classify config file as content: ```js module.exports = { From 0dc1227ae08da4a4f2b7153bd87ad16f4cfc7577 Mon Sep 17 00:00:00 2001 From: Simon Schweissinger Date: Wed, 22 May 2024 14:41:51 +0200 Subject: [PATCH 6/8] fix: use corrent indentation in tests config --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1f4917c..cd9f761 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest] + os: [ubuntu-latest] php: [8.3, 8.2] laravel: [11.*, 10.*] statamic: [5.*, 4.*] From cdf5b48a95a2d317fb32c21aa13173b9715d7a65 Mon Sep 17 00:00:00 2001 From: Simon Schweissinger Date: Wed, 22 May 2024 15:31:53 +0200 Subject: [PATCH 7/8] chore: attempt to fix tests --- composer.json | 4 ++-- phpunit.xml.dist | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 0a398c1..0c06409 100644 --- a/composer.json +++ b/composer.json @@ -6,12 +6,12 @@ "type": "statamic-addon", "autoload": { "psr-4": { - "VV\\Classify\\": "src" + "VV\\Classify\\": "src/" } }, "autoload-dev": { "psr-4": { - "VV\\Classify\\Tests\\": "tests" + "VV\\Classify\\Tests\\": "tests/" } }, "authors": [ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 60b567d..fbcdd11 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,18 @@ - + - tests/Unit/ + ./tests/Unit/ @@ -16,7 +26,7 @@ - src/ + ./src From 877d269118f278f9a6c37a1cd2e80a23e4535328 Mon Sep 17 00:00:00 2001 From: Simon Schweissinger Date: Wed, 22 May 2024 17:15:25 +0200 Subject: [PATCH 8/8] chore: fix tests with Statamic 5 --- .github/workflows/tests.yml | 4 +--- tests/TestCase.php | 7 ++++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd9f761..ff4e678 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -20,13 +20,11 @@ jobs: dependency-version: [prefer-lowest, prefer-stable] include: - laravel: 11.* - framework: ^11.0 testbench: 9.* - laravel: 10.* - framework: ^10.0 testbench: 8.* - name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ubuntu-latest + name: P${{ matrix.php }} - L${{ matrix.laravel }} - S${{ matrix.statamic }} - ${{ matrix.dependency-version }} steps: - name: Checkout code diff --git a/tests/TestCase.php b/tests/TestCase.php index 9931bad..5f108de 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -81,7 +81,12 @@ protected function resolveApplicationConfiguration($app) ]; foreach ($configs as $config) { - $app['config']->set("statamic.$config", require(__DIR__."/../vendor/statamic/cms/config/{$config}.php")); + $path = __DIR__."/../vendor/statamic/cms/config/{$config}.php"; + + // Statamic 5 does not have a `sites` config anymore, so we better check first + if (file_exists($path)) { + $app['config']->set("statamic.$config", require($path)); + } } // Setting the user repository to the default flat file system