Reputation: 1817
As I run "npm run production" mix generates minified files and saves them in specific directory. But how can I include them in my scripts and styles as the default name of the file is app.js and the one generated by mix is that it appends some charecter in name.
and in my blade file I have included in following way:
I am stuck at this as I wanted this inclusion process to be dynamic. Please suggest the approaches in which I can do it.
Upvotes: 2
Views: 469
Reputation: 163748
Use the mix()
helper. From the docs:
After generating the versioned file, you won't know the exact file name. So, you should use Laravel's global
mix
function within your views to load the appropriately hashed asset. Themix
function will automatically determine the current name of the hashed file:
<script src="{{ mix('/frontend/js/app.js') }}"></script>
Upvotes: 4