Laravel comes with laravel-mix, which is used to package static resources such as js, css, images, etc. The name of the generated file will be: app.asjduiik2l1323879dasfydua23.js, 即js原文件名+hash+.js后缀,因为中间的那个hash是随时会变化的,所以在页面引入js文件的时候,就不能写死文件的路径,而是使用mix('app.js'),此时laravel会自动去匹配当前的app.js对应哪个app+hash+.js的文件(项目public目录下会有一个mix-manifest.json, which stores the corresponding relationship between the two, and the file will be updated every time the static resources are packaged).
Sometimes we don’t want the hash value to be added to the name of the static resource (in most cases, it is a third-party library that is not a nodejs module and is introduced independently). At this time, we can directly use the asset method, which is simple and crude. Look for the file you named it.
Laravel comes with laravel-mix, which is used to package static resources such as js, css, images, etc. The name of the generated file will be:
app.asjduiik2l1323879dasfydua23.js
, 即js原文件名+hash+.js后缀
,因为中间的那个hash是随时会变化的,所以在页面引入js文件的时候,就不能写死文件的路径,而是使用mix('app.js')
,此时laravel会自动去匹配当前的app.js
对应哪个app+hash+.js
的文件(项目public目录下会有一个mix-manifest.json
, which stores the corresponding relationship between the two, and the file will be updated every time the static resources are packaged).Sometimes we don’t want the hash value to be added to the name of the static resource (in most cases, it is a third-party library that is not a nodejs module and is introduced independently). At this time, we can directly use the asset method, which is simple and crude. Look for the file you named it.