所以laravel mix命令mix.copy似乎优化了图像,但是,我需要完全相同的文件结构中的图像,所以我在公共目录中有图像文件夹,我想运行mix.copy,这将优化图像并保留它们在同一目录中,但是此时我运行它会删除第一个图像并抛出错误:
错误:ENOENT:没有这样的文件或目录,打开 ' C:\ XAMPP \ htdocs中\ laravel \公共\图像\ default.gif'
在运行npm run prod
之前,该文件已存在mix.styles([
'resources/assets/css/bootstrap-social.css',
'resources/assets/css/bootstrap.css',
'resources/assets/css/dropzone.css',
'resources/assets/css/jquery-ui.css',
'resources/assets/css/jquery-ui.structure.css',
'resources/assets/css/jquery-ui.theme.css',
'resources/assets/css/nav.css'
], 'public/css/style.css');
mix.scripts([
'resources/assets/js/pace.js',
'resources/assets/js/jquery.js',
'resources/assets/js/page-load.js',
'resources/assets/js/search.js',
'resources/assets/js/bootstrap.js',
'resources/assets/js/dropzone.js',
'resources/assets/js/image-upload.js',
'resources/assets/js/jquery-ui.js',
'resources/assets/js/googlemap.js',
], 'public/js/script.js');
mix.copy("public/images/*.*", "public/images/");
mix.browserSync('http://localhost:8000');
答案 0 :(得分:0)
试试这种方式..
mix.copyDirectory('assets/img', 'public/img');
此代码应该有效。