4

I can't use the app.css in my application. Every time the server returns following error

GET http://localhost:8000/css/app.css net::ERR_ABORTED 404 (Not Found).

I use a blade page.

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

I tried to use php artisan serve and php -S localhost:8000 -t public and the booth didn't work.

6
  • My code is: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Login</title> </head> <link href="{{ asset('css/app.css') }}" rel="stylesheet"> <body> <section id="conteudo-view" class=login> <h1>Login</h1> {!! Form::open(['route' => 'user.login', 'method' => 'post']) !!} <p>Acesse o Sistema</p> <label> </label> <label> </label> {!! Form::close() !!} </section> </body> </html> Commented Nov 15, 2020 at 19:44
  • Where is css/app.css is placed? Commented Nov 15, 2020 at 19:44
  • C:\xampp\htdocs\project\resources\css Commented Nov 15, 2020 at 19:45
  • 1
    css and js files must be in public folder ... Commented Nov 15, 2020 at 19:45
  • 1
    Did you actually compile your assets? npm run dev or npm run watch? The manual Commented Nov 15, 2020 at 19:48

4 Answers 4

7

try this before running your project on server make sure to compile laravel-mix

npm install

and then run

npm run dev

your facing the error because app.css not compiled yet

Sign up to request clarification or add additional context in comments.

Comments

0

Make sure you compile your css imports properly in resources/css/app.css first. It should look something like this:

// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');

// Bootstrap
@import 'bootstrap';

// Font Awesome
@import '@fortawesome/fontawesome-free';

Then, run this on your terminal: npm run dev. This will in turn, compile your app.css in your public/css. If you are making custom css definitions, i suggest using a custom.css and putting it in your public/css folder, and define it BELOW your app.css, like:

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

Assets must always be in the public folder so they can be seen by the {{asset ('') }} command.

Comments

-1

Use this worked 100%

run this command

npm i vue-loader

then run

npm run dev

you will get your solution .

Comments

-1

This the step for installing:

composer require laravel/ui --dev

php artisan ui bootstrap

php artisan ui bootstrap --auth

npm install

npm run dev

If you get an error at this step you can try this:

npm run prod or npm run production

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.