Skip to content

Commit 99cede2

Browse files
authored
Merge pull request #35 from visuellverstehen/update-requirements-for-v5
Add support for Statamic 5, drop support for Statamic 3, laravel 8 and 9 plus php 8.1 and lower
2 parents 85a2ae9 + 877d269 commit 99cede2

File tree

5 files changed

+45
-57
lines changed

5 files changed

+45
-57
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,18 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
php: [8.2, 8.1, 8.0, 7.4]
17-
laravel: [10.*, 9.*, 8.*]
18-
statamic: [4.*, 3.*]
19-
dependency-version: [prefer-stable]
2016
os: [ubuntu-latest]
17+
php: [8.3, 8.2]
18+
laravel: [11.*, 10.*]
19+
statamic: [5.*, 4.*]
20+
dependency-version: [prefer-lowest, prefer-stable]
2121
include:
22+
- laravel: 11.*
23+
testbench: 9.*
2224
- laravel: 10.*
2325
testbench: 8.*
24-
- laravel: 9.*
25-
testbench: 7.*
26-
- laravel: 8.*
27-
testbench: 6.*
28-
exclude:
29-
- laravel: 9.*
30-
statamic: ^3.2
31-
- laravel: 9.*
32-
php: 7.4
33-
- laravel: 10.*
34-
php: 8.0
35-
- laravel: 10.*
36-
php: 7.4
3726

38-
name: P${{ matrix.php }} - S${{ matrix.statamic }} - L${{ matrix.laravel }}
27+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - S${{ matrix.statamic }} - ${{ matrix.dependency-version }}
3928

4029
steps:
4130
- name: Checkout code

README.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![Statamic 3](https://img.shields.io/badge/Statamic-v3-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify)
21
[![Statamic 4](https://img.shields.io/badge/Statamic-v4-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify)
2+
[![Statamic 5](https://img.shields.io/badge/Statamic-v5-FF269E?style=for-the-badge&link=https://statamic.com)](https://statamic.com/addons/visuellverstehen/classify)
33
[![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)
44

55
# Classify
@@ -9,23 +9,9 @@ Classify is a useful helper to add CSS classes to all HTML tags generated by the
99

1010
## Requirements
1111

12-
- Statamic v3 || v4
13-
- Laravel 9 || 10
14-
- PHP 8
15-
16-
### Version compatibility
17-
18-
| Classify | Statamic | Laravel
19-
|:----------|:----------------|:---------
20-
| ^1.0 | 3.0 | ^7.0
21-
| ^2.0 | 3.0 | ^8.0
22-
| ^2.1 | 3.1 | ^8.0
23-
| ^2.2 | 3.1 | ^8.0
24-
| ^2.3 | 3.2 | ^8.0
25-
| ^2.4 | ^3.0 | ^9.0
26-
| ^2.5 | ^3.0 \|\| ^4.0 | ^9.0
27-
| ^2.6 | ^3.0 \|\| ^4.0 | ^9.0 \|\| ^10.0
28-
12+
- Statamic v4 || v5
13+
- Laravel 10 || 11
14+
- PHP 8.2+
2915

3016
## Installation
3117

@@ -74,7 +60,7 @@ If you want to use the default style set, use the `classify` modifier.
7460
{{ bard_text | classify }}
7561
```
7662

77-
If you want to add multiple style sets, define those in the config file. For example:
63+
If you want to add multiple style sets, you can define those in the config file:
7864
```php
7965
'default' => [
8066
//
@@ -101,23 +87,21 @@ If you want to get the defined classes for a certain element, you can get them s
10187
// output: link hover:underline
10288
```
10389

104-
## Nested selectors (min version 2.2)
105-
You can nest your selectors to flexible style elements in different contexts.
90+
## Nested selectors
91+
You can nest your selectors to style elements differently in varying contexts.
92+
93+
Let's assume you want to style links inside lists differently to a general link, you can make use of nesting:
10694

107-
Let's assume you want to style links inside lists differently than a general link, you can make use of nesting:
10895
```php
10996
`ul li p a` => 'my-secial-css-class-for-nested-links-in-lists`,
11097
`a` => `a-general-link-class`,
11198
```
11299

113-
The order doesn't matter. Classify will take care of that for you.
100+
Classify will take care of the order, so you don't need to define the nested selector before the general selector.
114101

115102
## Working with CSS frameworks (like TailwindCSS)
116103

117-
Some CSS frameworks utilize JIT compiling, or have some other means of purging CSS classes from production builds to reduce file sizes.
118-
119-
Make sure to include your CSS classes as content, so TailwindCSS can include those in the compiled file. This is important, as your
120-
classify CSS classes may not be in your template files, as they will be added dynamically.
104+
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:
121105

122106
```js
123107
module.exports = {

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "visuellverstehen/statamic-classify",
33
"description": "A useful helper to add CSS classes to all HTML tags generated by the bard editor.",
4-
"keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v3", "v4" ],
4+
"keywords": [ "statamic", "addon", "bard", "css", "prose", "typography", "v4", "v5" ],
55
"license": "proprietary",
66
"type": "statamic-addon",
77
"autoload": {
88
"psr-4": {
9-
"VV\\Classify\\": "src"
9+
"VV\\Classify\\": "src/"
1010
}
1111
},
1212
"autoload-dev": {
1313
"psr-4": {
14-
"VV\\Classify\\Tests\\": "tests"
14+
"VV\\Classify\\Tests\\": "tests/"
1515
}
1616
},
1717
"authors": [
@@ -23,14 +23,14 @@
2323
"email": "[email protected]"
2424
},
2525
"require": {
26-
"php": "^7.4 || ^8.0",
27-
"illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0",
28-
"statamic/cms": "^3.0.38 || ^4.0 || ^5.0",
29-
"symfony/dom-crawler": "^5.4 || ^6.0",
26+
"php": "^8.2 || ^8.3",
27+
"laravel/framework": "^10.0 || ^11.0",
28+
"statamic/cms": "^4.0 || ^5.0",
29+
"symfony/dom-crawler": "^6.0",
3030
"symfony/css-selector": "^5.4 || ^6.0 || ^7.0"
3131
},
3232
"require-dev": {
33-
"orchestra/testbench": "^6.0 || ^7.0 || ^8 || ^9",
33+
"orchestra/testbench": "^8 || ^9",
3434
"phpunit/phpunit": "^9.3 || ^10.0"
3535
},
3636
"scripts": {

phpunit.xml.dist

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" cacheResult="true" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
5+
bootstrap="vendor/autoload.php"
6+
backupGlobals="false"
7+
cacheResult="true"
8+
colors="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
cacheDirectory=".phpunit.cache"
12+
backupStaticProperties="false">
313
<testsuites>
414
<testsuite name="Unit">
5-
<directory suffix="Test.php">tests/Unit/</directory>
15+
<directory suffix="Test.php">./tests/Unit/</directory>
616
</testsuite>
717
</testsuites>
818
<php>
@@ -16,7 +26,7 @@
1626
</php>
1727
<source>
1828
<include>
19-
<directory suffix=".php">src/</directory>
29+
<directory suffix=".php">./src</directory>
2030
</include>
2131
</source>
2232
</phpunit>

tests/TestCase.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ protected function resolveApplicationConfiguration($app)
8181
];
8282

8383
foreach ($configs as $config) {
84-
$app['config']->set("statamic.$config", require(__DIR__."/../vendor/statamic/cms/config/{$config}.php"));
84+
$path = __DIR__."/../vendor/statamic/cms/config/{$config}.php";
85+
86+
// Statamic 5 does not have a `sites` config anymore, so we better check first
87+
if (file_exists($path)) {
88+
$app['config']->set("statamic.$config", require($path));
89+
}
8590
}
8691

8792
// Setting the user repository to the default flat file system

0 commit comments

Comments
 (0)