材质设计引导程序在laravel 7中不起作用?

时间:2020-07-08 15:32:43

标签: laravel bootstrap-4 material-design laravel-7 laravel-mix

我安装了https://fezvrasta.github.io/bootstrap-material-design/

然后我将这些行添加到webpack.mix

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .copy('node_modules/bootstrap-material-design/dist/js', 'public/bootstrap-material-design/dist/js')
    .copy('node_modules/bootstrap-material-design/dist/css', 'public/bootstrap-material-design/dist/css');

之后,我在app.blade.php

中使用此链接
<link rel="stylesheet" href="{{ mix("bootstrap-material-design/dist/css/app.css") }}">

我在想什么吗?

它给我这个错误

Facade\Ignition\Exceptions\ViewException
Unable to locate Mix file: /bootstrap-material-design/dist/css/app.css. (View: G:\VOice\resources\views\layouts\app.blade.php)

1 个答案:

答案 0 :(得分:0)

您做错了,试试这个。

npm i bootstrap-material-design
+ bootstrap-material-design@4.1.3
added 1 package from 1 contributor and audited 1344 packages in 6.477s

在app.scss中添加:

// Bootstrap Material
@import '~bootstrap-material-design/dist/css/bootstrap-material-design';

在booststrap.js中添加:

try {
    window.Popper = require('popper.js').default;
    window.$ = window.jQuery = require('jquery');

    require('bootstrap');
    require('bootstrap-material-design');
} 

运行构建:

npm run prod

在lauouts / app.blade.php

<link href="{{ mix('css/app.css') }}" rel="stylesheet">
<script src="{{ mix('js/app.js') }}"></script>