-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose bladeCompiler in blade.php to make extending blade easier and more future-proof #204
Expose bladeCompiler in blade.php to make extending blade easier and more future-proof #204
Conversation
Just made it optional to return an array from So just to be clear, from the example above, returning an array is now optional: /** @var \Illuminate\View\Compilers\BladeCompiler $bladeCompiler */
$bladeCompiler->component('_components.title');
// extend more
$bladeCompiler->include(...);
$bladeCompiler->directive(...);
-// make sure you still return an array!
-return [
- // custom directives...
- // Same thing as calling $bladeCompiler->directive(...) above
-]; |
This is awesome, can't wait to use it! Thanks Josh! |
jigsaw-core.php
Outdated
@@ -101,7 +101,7 @@ | |||
return new BladeMarkdownEngine($compilerEngine, $c[FrontMatterParser::class]); | |||
}); | |||
|
|||
(new BladeDirectivesFile($c['cwd'] . '/blade.php'))->register($bladeCompiler); | |||
BladeDirectivesFile::init($c['cwd'] . '/blade.php', $bladeCompiler)->register(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can ditch the init
static function, and just new
the class up here directly.
@JoshMoreno Thanks! I've suggested one change, and then we can merge this in. |
@damiani Sure thing. Removed. |
@damiani Thanks for merging! Really enjoying jigsaw. |
In
blade.php
theBladeCompiler
is now exposed as$bladeCompiler
;An example of registering a component alias:
blade.php
index.blade.php