1

我正在尝试将 metronic 主题集成到我现有的 laravel 项目中。我在 Laravel 宅基地结构中工作。

我一一完成了“ https://keenthemes.com/metronic/?page=docs§ion=laravel-integration ”链接中的步骤,但没有出现任何错误。但是,第6步中没有出现的/laravel/public/js/app.js/laravel/public/js/app.css文件没有出现。这可能是什么原因?

我的 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/call.js', 'public/js');
mix.js('resources/js/echo.js', 'public/js');

// copy images folder into laravel public folder
mix.copyDirectory('resources/demo1/src/assets/media', 'public/assets/media');

/**
* plugins specific issue workaround for webpack
* @see https://github.com/morrisjs/morris.js/issues/697
* @see https://stackoverflow.com/questions/33998262/jquery-ui-and-webpack-how-to-manage-it-into-module
*/
mix.webpackConfig({
   resolve: {
       alias: {
           'morris.js': 'morris.js/morris.js',
           'jquery-ui': 'jquery-ui',
       },
   },
});
4

1 回答 1

0

您忘记编译第 4 步中提到的 sass 和 js 文件。

将以下内容添加到您的webpack.mix.js:

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css');

要解决引导程序的问题,您必须确保导入路径正确:

更改以下内容resources/demo1/src/assets/sass/style.scss

import 'bootstrap/scss/bootstrap';

import '~bootstrap/scss/bootstrap';
于 2020-05-04T13:55:24.830 回答