Search code examples
phpcsslaravelnpmnpm-run

What's the purpose of Laravel's second app.css file?


I'm learning Laravel 8, and I'm confused as to what the purpose of Resources\css\app.css is. Everything else in the Resources folder seems to have a purpose, but not only is the app.css file here empty, adding anything to it and then compiling with npm run dev also does nothing.

If all custom CSS that I use with Laravel needs to be placed in public\css anyway, which is how I understand Laravel is supposed to work, what's the purpose of Resources\css\app.css?


Solution

  • You should write your CSS to the file within resources\css\app.css.

    Using Laravel Mix may then compile it, compress it and maybe do additional steps like purging unused CSS classes (if you‘d use something like TailwindCSS). This process will replace the file in public\css, so don’t write your styles directly to this file.