Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

项目中无法引入scss文件 #35

Open
Tiny-Box opened this issue Nov 15, 2018 · 1 comment
Open

项目中无法引入scss文件 #35

Tiny-Box opened this issue Nov 15, 2018 · 1 comment

Comments

@Tiny-Box
Copy link

按照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

@rewbilldou
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants