Skip to content
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

Splitting to multiple files #137

Closed
vpratfr opened this issue Apr 18, 2019 · 6 comments
Closed

Splitting to multiple files #137

vpratfr opened this issue Apr 18, 2019 · 6 comments

Comments

@vpratfr
Copy link

vpratfr commented Apr 18, 2019

Not sure if possible at all currently, but the Envoy.blade.php file tends to get larger and larger when tasks are added and made more flexible.

I have already externalized most of the configuration and I was wondering if there was a possibility to split the tasks from that file and put them in another file.

If not currently possible, do you think it would technically be easy to add this? I may be able to work on a PR if that is not a huge one.

Thanks!

@driesvints
Copy link
Member

Please see https://laravel.com/docs/5.8/envoy#setup

It's a PHP file so you can require whatever file you want.

@vpratfr
Copy link
Author

vpratfr commented Apr 18, 2019

@driesvints I did not manage to put my task definitions into other file.

Is the following supposed to work?

// Envoy.blade.php

@include('deployment/tasks.blade.php')

...

@story 
    foo
@endstory
// deployment/tasks.blade.php

@task('foo', [...])
    ls -al
@endtask 

@driesvints
Copy link
Member

Hmm, it seems this is indeed not possible which I believed otherwise. The include annotation works a bit different from Blade where it also parses the blade include. I believe if we could extend the include partial to also parse other files it might work. It's also a bit confusing that it's called Envoy.blade.php but Blade isn't actual used behind the hood.

@vpratfr
Copy link
Author

vpratfr commented Apr 19, 2019 via email

@LukaSikic
Copy link

Use @import instead of @include and it will work as you expected

@driesvints
Copy link
Member

@LukaSikic that indeed works. I'll try to add it to the docs soon but feel free to send in a PR before me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants