element-in-laravel-starter
element-in-laravel-starter copied to clipboard
项目中无法引入scss文件
按照usage操作,在执行yarn watch后,会爆一个ERR
ERROR Failed to compile with 1 errors
This dependency was not found:
* /Users/myusername/workplace/xxxx/element-in-laravel-starter/resources/sass/app.scss in multi ./resources/js/app.js ./resources/sass/app.scss
To install it, you can run: npm install --save /Users/myusername/workplace/xxxx/element-in-laravel-starter/resources/sass/app.scss
经过测试,在app.scss中进行任何编辑无法在页面中有什么改变,确定是无效的。
本地环境 node:v11.1.0 npm:6.4.1 yarn:1.12.3 php:7.1.19 composer:1.7.3
You have to link app.css
in the welcome.blade.php
, like below
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>Laravel</title>
<link rel="stylesheet" href="{{ mix('css/app.css') }}">
</head>
<body>
<div id="app"></div>
<script src="{{ mix('js/app.js') }}"></script>
</body>
</html>
You also need to import element-ui style into app.scss
, see below
// element UI
@import '~element-ui/lib/theme-chalk/index.css';
You are free to npm run dev