@@ -17,6 +17,8 @@ public function __construct(string $viewPaths = null, string $cachePath = null)
1717 public function configure (string $ viewPaths , string $ cachePath )
1818 {
1919 $ this ->blade = new \Jenssegers \Blade \Blade ($ viewPaths , $ cachePath );
20+ $ this ->setupDefaultDirectives ();
21+
2022 return $ this ->blade ; // Temporary Fix: Issue #5
2123 }
2224
@@ -58,4 +60,42 @@ public function blade()
5860 {
5961 return $ this ->blade ;
6062 }
63+
64+ /**
65+ * Setup default directives
66+ */
67+ protected function setupDefaultDirectives ()
68+ {
69+ $ this ->directive ('csrf ' , function ($ expression ) {
70+ return "<?php echo function_exists('csrf') && csrf()->form(); ?> " ;
71+ });
72+
73+ $ this ->directive ('method ' , function ($ expression ) {
74+ return "<?php echo '<input type= \"hidden \" name= \"_method \" value= \"' . $ expression . ' \" />'; ?> " ;
75+ });
76+
77+ $ this ->directive ('json ' , function ($ expression ) {
78+ return "<?php echo json_encode( $ expression); ?> " ;
79+ });
80+
81+ $ this ->directive ('vite ' , function ($ expression ) {
82+ return "<?php echo vite( $ expression); ?> " ;
83+ });
84+
85+ $ this ->directive ('meta ' , function ($ expression ) {
86+ return "<?php echo Meta( $ expression); ?> " ;
87+ });
88+
89+ $ this ->directive ('icon ' , function ($ expression ) {
90+ return "<?php echo Icon( $ expression); ?> " ;
91+ });
92+
93+ $ this ->directive ('jsIcon ' , function ($ expression ) {
94+ return "<?php echo e(Icon( $ expression)); ?> " ;
95+ });
96+
97+ $ this ->directive ('alpine ' , function ($ expression ) {
98+ return '<script defer src="https://cdn.jsdelivr.net/npm/[email protected] /dist/cdn.min.js"></script> ' ;
99+ });
100+ }
61101}
0 commit comments