问题描述
这是我的gulpfile.js文件
var elixir = require('laravel-elixir');
require('laravel-elixir-webpack');
elixir(函数(混合){
mix.styles([$ b $'vendor.css',
'font-awesome.css',
'theme-default.css',
'custom.css'
],'public / assets / css / index.css');
混合。脚本([
'vendor.js',
'demodata.js',
'app.js',
'demo.js'
],'public /assets/js/index.js');
mix.webpack('main.js');
mix.version('js / main.js','assets / css /index.css','assets/js/index.js');
});
这里是我的master.blade.php
<!DOCTYPE html>
< html lang =en>
< head>
< meta charset =utf-8>
< title> Wiredcademy | @yield(标题)LT /标题>
< meta name =viewportcontent =width = device-width,initial-scale = 1,user-scalable = 0,shrink-to-fit = no>
< meta name =format-detectioncontent =telephone = no>
< link href =http://fonts.googleapis.com/css?family=Montserrat:400,700%7cSource+Sans+Pro:200,400,600,700,900,400italic,700italic&subset=latin,latin-ext =stylesheettype =text / css>
< link rel =stylesheethref ={{elixir('assets / css / index.css')}}>
< / head>
< body class =index menu-default hover-default scroll-animation>
@yield('contents')
< script src ={{elixir('assets / js / index.js')}}>< /脚本>
< script src ={{elixir('js / main.js')}}>< / script>
< / body>
< / html>
我对使用gulp相当陌生。因此,我输入了gulp和gulp watch命令来跟踪脚本和样式表,并分别更改我的main.js但是当我通过php artisan serve部署应用程序时。
它说:
也许是由于你的版本。当您使用 mix.version()
时,您必须使用 mix
来拉动您的资产以及布局文件,因为 mix
会对文件名进行散列处理,只知道当前名称是什么。
< link rel =stylesheethref ={{mix('/ assets / css / index.css')}}>
不要忘记wordware lash /
。
来源:
更新
使用Laravel 2,对不起。
我认为这个错误来自于您继续使用 mix.version()
。
您可以通过它传递许多字符串而不是数组。
mix.version('single-file');
mix.version(['file-1','file-2]);
Here is my gulpfile.js file
var elixir = require('laravel-elixir');
require('laravel-elixir-webpack');
elixir(function(mix) {
mix.styles([
'vendor.css',
'font-awesome.css',
'theme-default.css',
'custom.css'
],'public/assets/css/index.css');
mix.scripts([
'vendor.js',
'demodata.js',
'app.js',
'demo.js'
],'public/assets/js/index.js');
mix.webpack('main.js');
mix.version('js/main.js','assets/css/index.css','assets/js/index.js');
});
And here is my master.blade.php
<!DOCTYPE html>
<html lang= "en">
<head>
<meta charset = "utf-8">
<title>Wiredcademy | @yield('title')</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0, shrink-to-fit=no">
<meta name="format-detection" content="telephone=no">
<link href="http://fonts.googleapis.com/css?family=Montserrat:400,700%7cSource+Sans+Pro:200,400,600,700,900,400italic,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{{ elixir('assets/css/index.css') }}">
</head>
<body class="index menu-default hover-default scroll-animation">
@yield('contents')
<script src="{{ elixir('assets/js/index.js') }}"></script>
<script src="{{ elixir('js/main.js') }}"></script>
</body>
</html>
I'm fairly new to using gulp. So I did type gulp and gulp watch commands to keep track of scripts and stylesheets and changes to my main.js respectively But when I deploy the app through php artisan serve.
it says:
Perhaps due to your versionning. When you use mix.version()
, you will have to use mix
to pull your assets as well in your layout file, because mix
hashes the file name and only it knows what the current name is.
<link rel="stylesheet" href="{{ mix('/assets/css/index.css') }}">
Don't forget the wordware lash /
.
Source here: https://laravel.com/docs/5.4/mix#versioning-and-cache-busting
UpdateUsing Laravel 2, sorry.
I think the error comes from your use of mix.version()
still. You pass it many strings instead of an array.
mix.version('single-file');
mix.version(['file-1', 'file-2]);
这篇关于设置vue和laravel的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!