Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
Running php artisan twill:build with having at least one custom-icon leads to an ErrorException.
This happens because twill is trying to copy the custom icon from its application specific location resources/views/twill/icons to the package specific location vendor/area17/twill/frontend/icons-custom using the PHP build-in copy function. However due to the fact that the directory vendor/area17/twill/frontend/icons-custom does not exist, the error occures.
The package does this in \A17\Twill\Commands\Build::copyIcons.
In Twill 2.x there was a checkto create the directory if it does not exist. Unfortunately this check has been removed in version 3.x
add a demo svg file named example.svg in the application specific directory resources/views/twill/icons
run php artisan twill:build
you may also dump (or add a breakpoint) in the method \A17\Twill\Commands\Build::copyIcons to allow showing source and target paths (considering the fact that you have a custom icon that should be copied, see 1.) and you run twill:build, see 2.))
Expected result
the icon can be moved to the targetDirectory correctly.
Actual result
An ErrorException is being thrown.
ErrorException
copy({YOURPATH}/vendor/area17/twill/frontend/icons-custom/{YOURCUSTOMSVGICONNAME}.svg): Failed to open stream: No such file or directory
Description
Running
php artisan twill:build
with having at least one custom-icon leads to an ErrorException.This happens because twill is trying to copy the custom icon from its application specific location
resources/views/twill/icons
to the package specific locationvendor/area17/twill/frontend/icons-custom
using the PHP build-in copy function. However due to the fact that the directoryvendor/area17/twill/frontend/icons-custom
does not exist, the error occures.The package does this in
\A17\Twill\Commands\Build::copyIcons
.In Twill 2.x there was a checkto create the directory if it does not exist. Unfortunately this check has been removed in version 3.x
Twill 3.x: (copyIcons) https://github.com/area17/twill/blob/5bddccfb4c4a30afcd704a7e2b1a97026b0c14b0/src/Commands/Build.php#L235 Twill 2.x (copyIcons with prior check): https://github.com/area17/twill/blob/a068e1b13c8a7c005bf61d1b57871f941018fc2f/src/Commands/Build.php#L228
Steps to reproduce
example.svg
in the application specific directoryresources/views/twill/icons
php artisan twill:build
you may also dump (or add a breakpoint) in the method
\A17\Twill\Commands\Build::copyIcons
to allow showing source and target paths (considering the fact that you have a custom icon that should be copied, see 1.) and you run twill:build, see 2.))Expected result
the icon can be moved to the targetDirectory correctly.
Actual result
An ErrorException is being thrown.
Versions
Twill version: 3.0.2 Laravel version: 10.39 PHP version: 8.2 Database engine: mysql