Laravel 5.4中的混合/版本图像? [英] Mix/version images in Laravel 5.4?

查看:72
本文介绍了Laravel 5.4中的混合/版本图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一组图像上使用混合.首先,我将它们复制:

I want to use mix on a set of images. First I copy them:

mix.copy('resources/images', 'public/images');

然后的版本:

mix.version();

上面对图像没有任何作用.

The above does nothing to the images.

我也尝试过指定路径:

mix.version('public/images/*');

但是我没有出现这样的文件或目录错误.

But I get a no such file or directory error.

如何对图像进行版本控制?

How can I version the images?

推荐答案

我知道这是一个老问题,但是对于2019年-laravel mix 4,您可以使用:

I know it's an old question, but for 2019 - laravel mix 4 you can use:

mix.copy('resources/images/*', 'public/images');
mix.version();

这将对所有复制的文件进行版本控制. 请勿使用以下其中一项:

This will version all your copied files. DON'T use one of these:

mix.copy('resources/images/*', 'public/images/*'); 
mix.copy('resources/images/', 'public/images/*'); 
mix.copyDirectory('resources/images/*', 'public/images'); 

->然后将不对文件进行版本控制.

-> it will not version the files then.

看到结果,看看public/mix-manifest.json:

The see the result, take a look in the public/mix-manifest.json:

"/favicon.ico": "/favicon.ico?id=ecb5fdce0172885513c8",

要在代码中使用它,请使用laravel混合帮助器方法:mix();

To use it in code, use the laravel mix helper method: mix();

<link rel="icon" type="image/x-icon" href="{{ mix('favicon.ico') }}" />

这将生成如下内容:

<link rel="icon" type="image/x-icon" href="/favicon.ico?id=ecb5fdce0172885513c8" />

这篇关于Laravel 5.4中的混合/版本图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆