Skip to content

Instantly share code, notes, and snippets.

@troymcginnis
Last active May 16, 2018 18:16
Show Gist options
  • Save troymcginnis/87eea3dc7697d349973c405ca7c8ec20 to your computer and use it in GitHub Desktop.
Save troymcginnis/87eea3dc7697d349973c405ca7c8ec20 to your computer and use it in GitHub Desktop.
<?php
namespace App;
/**
* Custom Blade directives
*/
add_action('after_setup_theme', function () {
/**
* Icon Blade directives
*/
sage('blade')->compiler()->directive('icon', function ($id) {
if($id){
return '<svg class="icon icon--' . $id . '"><use xlink:href="' . asset_path("images/symbols.svg") . '#icon-' . $id . '"></use></svg>';
}
});
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@icon('facebook')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment