Skip to content

Commit

Permalink
added auto update generation config (#4)
Browse files Browse the repository at this point in the history
* added auto update generation config

* updated the tests
  • Loading branch information
swapnilsarwe authored Feb 27, 2023
1 parent dbb59f9 commit 1245464
Show file tree
Hide file tree
Showing 625 changed files with 657 additions and 619 deletions.
Empty file added .env
Empty file.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ composer.lock
phpunit.xml
.php-cs-fixer.cache
package-lock.json
dist/
34 changes: 33 additions & 1 deletion config/generation.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
<?php

use Codeat3\BladeIconGeneration\IconProcessor;

$svgNormalization = static function (string $tempFilepath, array $iconSet) {

// perform generic optimizations
$iconProcessor = new IconProcessor($tempFilepath, $iconSet);
$iconProcessor
->optimize()
->postOptimizationAsString(function ($svgLine){
// $svgLine = str_replace('stroke="#000"', 'stroke="currentColor"', $svgLine);
// return str_replace('fill="black"', 'fill="currentColor"', $svgLine);
$replacePattern = [
'/stroke="#[0-9A-Z]+"/s' => 'stroke="currentColor"',
'/fill="#[0-9A-Z]+"/s' => 'fill="currentColor"',
];
return preg_replace(array_keys($replacePattern), array_values($replacePattern), $svgLine);
})
->save();
};

return [
[
'source' => null,
// Define a source directory for the sets like a node_modules/ or vendor/ directory...
'source' => __DIR__.'/../dist/public/img',

// Define a destination directory for your icons. The below is a good default...
'destination' => __DIR__.'/../resources/svg',

// Enable "safe" mode which will prevent deletion of old icons...
'safe' => false,

// Call an optional callback to manipulate the icon
// with the pathname of the icon and the settings from above...
'after' => $svgNormalization,

'is-solid' => true,
],
];
2 changes: 1 addition & 1 deletion resources/svg/accessibility.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/achievement.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/action.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/actions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/ad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/add-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/add.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/aed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/aggregate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/aid-option.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/aid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/alarm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/alert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/amazon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/amex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/svg/analytics.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1245464

Please sign in to comment.