Skip to content
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
16 changes: 8 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#

name: CI
permissions:
contents: read

on:
pull_request:
Expand All @@ -19,8 +21,6 @@ on:
push:
branches:
- 'master'
schedule:
- cron: '48 */8 * * *'

env:
COLUMNS: 120
Expand All @@ -34,7 +34,7 @@ jobs:
JBZOO_COMPOSER_UPDATE_FLAGS: ${{ matrix.composer_flags }}
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
coverage: [ xdebug, none ]
composer_flags: [ "--prefer-lowest", "" ]
steps:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
run: make report-coveralls --no-print-directory || true

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: PHPUnit - ${{ matrix.php-version }} - ${{ matrix.coverage }}
Expand All @@ -77,7 +77,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -99,7 +99,7 @@ jobs:
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Linters - ${{ matrix.php-version }}
Expand All @@ -111,7 +111,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ 8.1, 8.2, 8.3 ]
php-version: [ 8.2, 8.3, 8.4 ]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -133,7 +133,7 @@ jobs:
run: make report-all --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Reports - ${{ matrix.php-version }}
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# JBZoo / Less

[![CI](https://github.com/JBZoo/Less/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Less/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Less/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Less?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Less/coverage.svg)](https://shepherd.dev/github/JBZoo/Less) [![Psalm Level](https://shepherd.dev/github/JBZoo/Less/level.svg)](https://shepherd.dev/github/JBZoo/Less) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/less/badge)](https://www.codefactor.io/repository/github/jbzoo/less/issues)
[![CI](https://github.com/JBZoo/Less/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/JBZoo/Less/actions/workflows/main.yml?query=branch%3Amaster) [![Coverage Status](https://coveralls.io/repos/github/JBZoo/Less/badge.svg?branch=master)](https://coveralls.io/github/JBZoo/Less?branch=master) [![Psalm Coverage](https://shepherd.dev/github/JBZoo/Less/coverage.svg)](https://shepherd.dev/github/JBZoo/Less) [![Psalm Level](https://shepherd.dev/github/JBZoo/Less/level.svg)](https://shepherd.dev/github/JBZoo/Less) [![CodeFactor](https://www.codefactor.io/repository/github/jbzoo/less/badge)](https://www.codefactor.io/repository/github/jbzoo/less/issues)
[![Stable Version](https://poser.pugx.org/jbzoo/less/version)](https://packagist.org/packages/jbzoo/less/) [![Total Downloads](https://poser.pugx.org/jbzoo/less/downloads)](https://packagist.org/packages/jbzoo/less/stats) [![Dependents](https://poser.pugx.org/jbzoo/less/dependents)](https://packagist.org/packages/jbzoo/less/dependents?order_by=downloads) [![GitHub License](https://img.shields.io/github/license/jbzoo/less)](https://github.com/JBZoo/Less/blob/master/LICENSE)



PHP wrapper for [wikimedia/less.php](https://github.com/wikimedia/less.php).
PHP wrapper for [wikimedia/less.php](https://github.com/wikimedia/less.php).


## Install
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"prefer-stable" : true,

"require" : {
"php" : "^8.1",
"php" : "^8.2",

"jbzoo/data" : "^7.1",
"jbzoo/utils" : "^7.1",
"wikimedia/less.php" : ">=4.2.0"
"jbzoo/data" : "^7.2",
"jbzoo/utils" : "^7.3",
"wikimedia/less.php" : ">=5.4.0"
},

"require-dev" : {
"jbzoo/toolbox-dev" : "^7.1"
"jbzoo/toolbox-dev" : "^7.2"
},

"autoload" : {
Expand Down
2 changes: 1 addition & 1 deletion src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@

namespace JBZoo\Less;

class Exception extends \RuntimeException
final class Exception extends \RuntimeException
{
}
5 changes: 4 additions & 1 deletion src/Less.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
use JBZoo\Utils\Sys;
use JBZoo\Utils\Url;

/**
* @psalm-suppress UnusedClass
*/
final class Less
{
private Data $options;
Expand Down Expand Up @@ -136,7 +139,7 @@ private function prepareBasePath(?string $basePath, string $default): string
$basePath = $basePath === '' || $basePath === null ? $default : $basePath;

if (!Url::isAbsolute($basePath)) {
$basePath = \trim($basePath, '\\/');
$basePath = \trim($basePath, '\/');
$basePath = $this->options->getString('root_url') . '/' . $basePath;
}

Expand Down
2 changes: 2 additions & 0 deletions tests/AbstractLessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public function testImportPathsUndefined(): void

public function testDebugOn(): void
{
skip('Not supported yet');
$less = new Less(['debug' => true]);

$actual = $less->compile('tests/resources/simple.less');
Expand All @@ -218,6 +219,7 @@ public function testDebugOn(): void

public function testDebugOff(): void
{
skip('Not supported yet');
$less = new Less();
$actual = $less->compile('tests/resources/simple.less');
$content = \file_get_contents($actual);
Expand Down
14 changes: 7 additions & 7 deletions tests/expected-gpeasy/autoload.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
}
opacity: 70 / 100;
filter: alpha(opacity=70);
}
20 changes: 10 additions & 10 deletions tests/expected-gpeasy/custom_root_url.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('//custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('//custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
}
font-weight: bold;
}
20 changes: 10 additions & 10 deletions tests/expected-gpeasy/custom_root_url_complex.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('../../path/tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('../../path/tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
}
font-weight: bold;
}
20 changes: 10 additions & 10 deletions tests/expected-gpeasy/custom_root_url_dot.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
}
font-weight: bold;
}
20 changes: 10 additions & 10 deletions tests/expected-gpeasy/custom_root_url_http.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('http://custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('http://custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
}
font-weight: bold;
}
20 changes: 10 additions & 10 deletions tests/expected-gpeasy/custom_root_url_https.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('https://custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('https://custom-site.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
}
font-weight: bold;
}
2 changes: 1 addition & 1 deletion tests/expected-gpeasy/function.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.my-div {
content: '0987654321';
content: '0987654321';
}
24 changes: 12 additions & 12 deletions tests/expected-gpeasy/import.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
.div-imported-2 {
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
}
.div-imported-2:hover {
background: #ff0000;
background: #ff0000;
}
.div-imported-2 p {
background: url('http://example.com/tests/resources/butterfly.jpg');
background: url('http://example.com/tests/resources/butterfly.jpg');
}
.div-imported-1-1 {
background: url('http://example.com/tests/resources/imported_1/some-image.jpg');
background: url('http://example.com/tests/resources/imported_1/some-image.jpg');
}
.div-imported-1-2 {
background: url('http://example.com/tests/resources/some-image.jpg');
background: url('http://example.com/tests/resources/some-image.jpg');
}
.div-imported-1-3 {
background: url('http://example.com/tests/resources/some-image.jpg');
background: url('http://example.com/tests/resources/some-image.jpg');
}
.div-imported-3 {
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");
}
.div-imported-3:hover {
background: #ff0000;
background: #ff0000;
}
a:hover {
color: #ff0000;
color: #ff0000;
}
a:visited {
color: #00ff00;
color: #00ff00;
}
a:focus {
color: #0000ff;
}
color: #0000ff;
}
18 changes: 9 additions & 9 deletions tests/expected-gpeasy/simple.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
a {
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
-webkit-transition: all 0.4s;
-moz-transition: all 0.4s;
-o-transition: all 0.4s;
transition: all 0.4s;
background: url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7") 0 0 no-repeat;
}
a:hover {
opacity: 0.7;
filter: alpha(opacity=70);
background: url('http://example.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
opacity: 70 / 100;
filter: alpha(opacity=70);
background: url('http://example.com/tests/resources/butterfly.jpg') 0 0 no-repeat;
}
.food, .beer, .sleep, .javascript {
font-weight: bold;
font-weight: bold;
}
6 changes: 3 additions & 3 deletions tests/expected-gpeasy/vars.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
a:hover {
color: #f00;
color: #f00;
}
a:visited {
color: #0f0;
color: #0f0;
}
a:focus {
color: #00f;
color: #00f;
}
Loading