我对Laravel很陌生。我使用Ubuntu,并从GitHub的主文件夹中克隆了一个应用程序。当我使用php artisan serve
运行应用程序时,看不到页面样式。 Ctrl-u
可以毫无问题地显示源,但是在控制台中,关于资产文件夹下的所有内容,我都出现404错误。
console warnings can be seen here
我的000_default.conf文件是
/etc/apache2/sites-enabled/000-defult.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot ~/_/www/easymove/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/laravel>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
应用程序根目录webpack.mix.js
的内容如下:
const mix = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css');
答案 0 :(得分:0)
您需要在webpack.mix.js中添加一些规则来处理资产。
当前,您的webpack将仅编译JS文件。您还需要让它复制图像的文件和目录,并根据其当前位置编译css:
https://laravel.com/docs/7.x/mix#copying-files-and-directories