diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f99cefe90..c20f901ce 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -27,6 +27,9 @@ jobs: extensions: opcache, gd coverage: none + - name: Update composer + run: composer update + - name: Validate composer.json and composer.lock run: composer validate diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fdfaf6e0..322fe14c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -544,8 +544,11 @@ # v1.6.31 ## mm/dd/2020 +1. [](#improved) + * Allow all CSS and JS via `robots.txt` [#2006](https://github.com/getgrav/grav/issues/2006) [#3067](https://github.com/getgrav/grav/issues/3067) 1. [](#bugfix) * Fixed `pages` field escaping issues, needs admin update, too [admin#1990](https://github.com/getgrav/grav-plugin-admin/issues/1990) + * Fix `svg-image` issue with classes applied to all elements [#3068](https://github.com/getgrav/grav/issues/3068) # v1.6.30 ## 12/03/2020 diff --git a/robots.txt b/robots.txt index 96406e45e..9ac278fd4 100644 --- a/robots.txt +++ b/robots.txt @@ -11,3 +11,5 @@ Allow: /user/pages/ Allow: /user/themes/ Allow: /user/images/ Allow: / +Allow: *.css$ +Allow: *.js$ \ No newline at end of file diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index 39efc9ae4..0e8a25951 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -1452,12 +1452,13 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface } //Look for existing class - $svg = preg_replace_callback('/^/', function($matches) use ($classes, &$matched) { + $svg = preg_replace_callback('/^]*(class=\")([^"]*)(\")[^>]*>/', function($matches) use ($classes, &$matched) { if (isset($matches[2])) { $new_classes = $matches[2] . $classes; $matched = true; return str_replace($matches[1], "class=\"$new_classes\"", $matches[0]); } + return $matches[0]; }, $svg );