-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblade.php
More file actions
54 lines (49 loc) · 1.37 KB
/
Copy pathblade.php
File metadata and controls
54 lines (49 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* Laravel Mix mix() wrapper
*
* @return string Correct asset path based on build environment
*/
$bladeCompiler->directive('mix', function($expression) {
return '<?php echo $page->getAssetPath('.$expression.') . mix('.$expression.'); ?>';
});
/**
* Get the contents of a file
*
* Example:
* @fileContents(source/img/icons/logo.svg)
*
* @return string File contents
*/
$bladeCompiler->directive('fileContents', function($expression) {
return '<?php
$file = '.$expression.';
echo file_exists($file) ? file_get_contents($file) : ""; ?>';
});
/**
* YouTube Video Embed
*
* Example:
* @youtube('123456')
*
* @return string HTML Markup for embedding a YouTube video.
*/
$bladeCompiler->directive('youtube', function($expression) {
return '<?php
$id = str_replace("\'", "", ' . $expression . ');
echo "<div class=\"relative aspect-ratio-16/9 mb-4\"><iframe class=\"absolute w-full h-full pin-t\" src=\"https://www.youtube.com/embed/$id?rel=0\" frameborder=\"0\" allowfullscreen></iframe></div>"; ?>';
});
/**
* File Tree component
*
* Use markdown lists to create an expandable file tree.
*
* Example:
* @filetree
* - Static folder
* - [Expandable folder](#)
* - [Another expandable folder](#)
* - Another static folder
* @endfiletree
*/
$bladeCompiler->component('_layouts.default.components.filetree');