Defect #41712
closedFix Path for Plugin Assets Added by Rake Task
0%
Description
The Rake task added in Feature #23980 Replace icon images with Tabler SVG icons helps add SVG icons to plugins.
However, there is a mismatch between the path where the Rake task places icons and the path used by asset precompilation.
Because of this, icons added by the Rake task are not available as static assets.
Below, I explain the path difference between the Rake task and asset precompilation, and then suggest a solution.
Path difference:¶
Where icons are placed by the Rake task (lit/tasks/icons.rake) | PLUGINS_ROOT/ app /assets/images/icons.svg |
Path expected by asset precompilation | PLUGINS_ROOT/assets |
Proposed Solution:¶
To fix this, I suggest updating the Rake task to place icons in the path used by asset precompilation (PLUGINS_ROOT/assets).
A diff with the changes is attached below.
diff --git a/lib/tasks/icons.rake b/lib/tasks/icons.rake
index bda10f2a21..d26f4405ab 100644
--- a/lib/tasks/icons.rake
+++ b/lib/tasks/icons.rake
@@ -75,7 +75,7 @@ unless Rails.env.production?
end
input_path = Rails.root.join("tmp", "icons", name)
- sprite_path = Rails.root.join('plugins', name, 'app', 'assets', 'images', 'icons.svg')
+ sprite_path = Rails.root.join('plugins', name, 'assets', 'images', 'icons.svg')
generate_svg_sprite(input_path, sprite_path)
end
Related issues
Updated by Go MAEDA 25 days ago
- Related to Feature #23980: Replace icon images with Tabler SVG icons added
Updated by Marius BĂLTEANU 23 days ago
- Related to Feature #39111: Enable Asset Pipeline Integration using Propshaft added
Updated by Marius BĂLTEANU 22 days ago
- Status changed from New to Closed
- Resolution set to Fixed
Thanks Takenori TAKAKI!
Initially, I've defined the path 'plugins', name, 'app', 'assets', 'images', 'icons.svg'
by purpose, but it seems that are some issues when the assets are loaded from that path so for now it is safer to use 'plugins', name, 'assets', 'images', 'icons.svg'
.