Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Statamic 3, laravel 8 and 9 plus php 8.1 and lower #35

Merged
merged 8 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,18 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.2, 8.1, 8.0, 7.4]
laravel: [10.*, 9.*, 8.*]
statamic: [4.*, 3.*]
dependency-version: [prefer-stable]
os: [ubuntu-latest]
php: [8.3, 8.2]
laravel: [11.*, 10.*]
statamic: [5.*, 4.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 11.*
testbench: 9.*
- laravel: 10.*
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 }} - S${{ matrix.statamic }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
Expand Down
38 changes: 11 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[![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
Expand All @@ -9,23 +9,9 @@ Classify is a useful helper to add CSS classes to all HTML tags generated by the

## Requirements

- Statamic v3 || v4
- Laravel 9 || 10
- 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

Expand Down Expand Up @@ -74,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' => [
//
Expand All @@ -101,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 = {
Expand Down
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"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", "v4", "v5" ],
"license": "proprietary",
"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": [
Expand All @@ -23,14 +23,14 @@
"email": "[email protected]"
},
"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": {
Expand Down
16 changes: 13 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
cacheResult="true"
colors="true"
processIsolation="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">tests/Unit/</directory>
<directory suffix="Test.php">./tests/Unit/</directory>
</testsuite>
</testsuites>
<php>
Expand All @@ -16,7 +26,7 @@
</php>
<source>
<include>
<directory suffix=".php">src/</directory>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
7 changes: 6 additions & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down