Last active
May 16, 2018 18:16
-
-
Save troymcginnis/87eea3dc7697d349973c405ca7c8ec20 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>'; | |
} | |
}); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@icon('facebook') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment