Expose bladeCompiler in blade.php to make extending blade easier and more future-proof#204
Merged
damiani merged 4 commits intotighten:masterfrom Mar 28, 2018
JoshMoreno:expose-blade-for-extension
Merged
Expose bladeCompiler in blade.php to make extending blade easier and more future-proof#204damiani merged 4 commits intotighten:masterfrom JoshMoreno:expose-blade-for-extension
damiani merged 4 commits intotighten:masterfrom
JoshMoreno:expose-blade-for-extension
Conversation
Contributor
Author
|
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! |
damiani
reviewed
Mar 27, 2018
| }); | ||
|
|
||
| (new BladeDirectivesFile($c['cwd'] . '/blade.php'))->register($bladeCompiler); | ||
| BladeDirectivesFile::init($c['cwd'] . '/blade.php', $bladeCompiler)->register(); |
Contributor
There was a problem hiding this comment.
I think we can ditch the init static function, and just new the class up here directly.
Contributor
|
@JoshMoreno Thanks! I've suggested one change, and then we can merge this in. |
Contributor
Author
|
@damiani Sure thing. Removed. |
Contributor
Author
|
@damiani Thanks for merging! Really enjoying jigsaw. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
blade.phptheBladeCompileris now exposed as$bladeCompiler;An example of registering a component alias:
blade.php
index.blade.php