maxxd Posted March 24, 2022 Share Posted March 24, 2022 Hey y'all. I'm currently working on a project at work and it involves creating a package with assets. Laravel's ServiceProvider has the loadRoutesFrom() and loadViewsFrom() methods which are all well and good, but the only solution I can find in the documentation or code for syncing javascript, font, and style files from the package to the full Laravel install is to run the artisan publish command. This means I'd have to run the publish command every time I make a change which is clearly not a solution I'm excited about. My solution at the moment is to use a symlink from the compiled assets location in the package directory to the appropriate directories in the public webroot of the overriding install - all good and working except for one thing. When I use the mix() helper in my view to load the javascript files they can't be found [ie: <script src="{{ mix('packagename/js/main.js') }}"</script>] where packagename is the symlink; however, when I point directly to them it works perfectly [ie: <script src="packagename/js/mix.js"></script>]. The asset() helper function works just fine. My only concern with just linking directly is that now I can't use versioning in my mix build process, my tester has a computer that caches aggressively. TL;DR - has anyone come across a situation where Laravel's native mix() function can't traverse a symlink or is this something known in the php ecosystem that I've somehow never come across before? Quote Link to comment https://forums.phpfreaks.com/topic/314617-laravel-mix-helper-method-and-symlinks/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.