简体   繁体   English

CSS 和 JS 不使用 Laravel 混合编译

[英]CSS and JS do not compile using Laravel Mix

I have a problem with the Laravel 8 framework.我对 Laravel 8 框架有疑问。 I tried to install NPM to work under the concept of Laravel Mix.我尝试安装 NPM 以在 Laravel Mix 的概念下工作。 My problem is that the CSS and JS do not compile.我的问题是 CSS 和 JS 无法编译。

webpack.mix.js webpack.mix.js

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [ 
        //
]) ;

package.json package.json

 {
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@popperjs/core": "^2.10.2",
        "axios": "^0.21",
        "bootstrap": "^5.1.3",
        "laravel-mix": "^6.0.6",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "resolve-url-loader": "^3.1.4",
        "sass": "^1.43.4",
        "sass-loader": "^11.1.1"
    }
}

At the top of your layout add...在布局的顶部添加...

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

And then at the bottom of your layout add...然后在布局的底部添加...

<script src="{{ mix('/js/app.js') }}"></script>

Creating projects has become easier than ever Small or even large projects, you can now create them easily.创建项目比以往任何时候都更容易小型甚至大型项目,您现在可以轻松创建它们。

https://github.com/sameralsayed/WOWLARA-Start-building-projects https://github.com/sameralsayed/WOWLARA-Start-building-projects

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM