Adding Files to mix-manifes.json, Versioning Extra Files
See original GitHub issue- Laravel Mix Version: 0.8.3
- Node Version (
node -v
): 7.5.0 - NPM Version (
npm -v
): 4.1.2 - OS: MacOS 10.12.3
I’d like to call some JS and CSS on only on a few specific pages. I’m achieve this by using Blade @stack()
and @push()
, however, simply using copy()
does not add these files to mix-manifes.json. This causes Laravel to throw an error when adding the files via {{ mix('myFile.ext') }}
. (I guess I could not use mix()
, but I feel like I should be.)
The only way I have found to add these files to mix-manifes.json is to version them. Is there another way to tell Mix to add files to the manifest?
This process lead me to the compile error below… am I doing something incorrect?
Description:
Versioning copied extra files throws an error when having a clean public folder. Error does not occur if the file exists from a previous non-versioned build.
mix.js('resources/assets/js/wfl.js', 'public/js')
.extract(['fluidvids.js', 'jquery', 'vue'])
.copy('node_modules/flatpickr/dist/flatpickr.js', 'public/js')
.copy('node_modules/flatpickr/dist/flatpickr.css', 'public/css')
.copy('node_modules/slick-carousel/slick/slick.js', 'public/js')
.copy('node_modules/slick-carousel/slick/slick.css', 'public/css')
.sass('resources/assets/sass/wfl.scss', 'public/css')
.copy('resources/assets/fonts', 'public/fonts', false)
.copy('resources/assets/images', 'public/images', false)
.sourceMaps()
.version(['public/css/flatpickr.css', 'public/js/flatpickr.js', 'public/css/slick.css', 'public/js/slick.js']);
Steps To Reproduce:
- have a clean public directory
- copy a css or js file to your public directory via
copy()
- version that file
Issue Analytics
- State:
- Created 7 years ago
- Comments:8
Top Results From Across the Web
Adding Files to mix-manifes.json, Versioning Extra Files #451
The only way I have found to add these files to mix-manifes.json is to version them. Is there another way to tell Mix...
Read more >Versioning | Laravel Mix Documentation
Version compiled assets AND public/js/file.js ... Laravel Mix's generated mix-manifest.json file, extract the asset file names, and then generate your HTML.
Read more >File name versioning of static assets using Laravel Mix
First, we're going to use Mix's version function which will populate a mix-manifest.json file with something that looks like this:.
Read more >Versioning with Mix, manifest does not exist. {but.... it does!)
json, so i changed it to what it was asking for 'manifest.json'. So I ran npm run production and... now It says; Unable...
Read more >how to use mix versioning in Laravel? - Stack Overflow
Mix.manifest.json is where Laravel looks to get the version number. You will also have to change how you grab your css and js...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m pushing an update to allow you to do this.
Hey @JeffreyWay, this is working great, thanks!
The workflow seems to copy the file to the destination as specified in your webpack.mix.js and then make a copy of that file to version it, leaving two files in the target directory. Would it be possible to have it trash the unhashed file at build?