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

[5.4] Allow multiple manifest files for mix helper #17759

Merged
merged 4 commits into from
Feb 4, 2017
Merged

[5.4] Allow multiple manifest files for mix helper #17759

merged 4 commits into from
Feb 4, 2017

Conversation

SeoFood
Copy link
Contributor

@SeoFood SeoFood commented Feb 3, 2017

If you have multiple laravel mix files (for backend and frontend) you can't use it with the helper.

Example mix File:

mix.setPublicPath('./public/admin')
mix.js('./js/app.js', '/js')

The mix-manifest.json is successfully saved in /public/admin/

Now you can add it in you blade Template with
<script src="{{ mix('js/app.js', 'admin') }}"></script>

It works with Hot Reload too and not breaking things.

@GrahamCampbell GrahamCampbell changed the title allow multiple manifest files for mix helper [5.4] Allow multiple manifest files for mix helper Feb 3, 2017
throw new Exception(
"Unable to locate Mix file: {$path}. Please check your ".
"Unable to locate Mix file: {$path}. Please check your " .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert all these cs changes

'webpack.mix.js output paths and try again.'
);
}

return $shouldHotReload = file_exists(public_path('hot'))
? new HtmlString("http://localhost:8080{$manifest[$path]}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert all these cs changes

$path = "/{$path}";
}

if (! array_key_exists($path, $manifest)) {
if ( ! array_key_exists($path, $manifest)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revert all these cs changes

@SeoFood
Copy link
Contributor Author

SeoFood commented Feb 3, 2017

sorry about that

@@ -552,38 +552,42 @@ function method_field($method)
/**
* Get the path to a versioned Mix file.
*
* @param string $path
* @param string $path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the changes to this line, and match the cs of the next line.

? new HtmlString("http://localhost:8080{$manifest[$path]}")
: new HtmlString($manifest[$path]);
return file_exists(public_path($manifestDir.'/hot'))
? new HtmlString("http://localhost:8080{$manifest[$path]}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert the indentation changes here.

@@ -552,18 +552,22 @@ function method_field($method)
/**
* Get the path to a versioned Mix file.
*
* @param string $path
* @param string $path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still a missing space after the word string in both cases

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be exactly 2 space characters

@taylorotwell taylorotwell merged commit 8dd5892 into laravel:5.4 Feb 4, 2017
@brunogaspar
Copy link
Contributor

@SeoFood How did you ended up doing for your multiple mix files to be executed?

You have one webpack.mix.js and then require the other ones in this one?

@SeoFood
Copy link
Contributor Author

SeoFood commented Feb 9, 2017

@brunogaspar No I have multiple webpack.mix.jsfor the frontend and for the backend because they use different webpack configs vendors and so on.

This is my Directory Structure for the admin:
image

For the frontend is use it as it is.

@brunogaspar
Copy link
Contributor

Ah right, makes sense, because i was trying to use the require() to require the individual files aswell on the main webpack.mix.js and only the frontend assets where being compiled.

Your way kinda makes sense as well, since you can have individual dependencies.

Thanks for the fast reply 👍

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

Successfully merging this pull request may close these issues.

4 participants