Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Amidamaru's avatar

Where to place additional CSS file in Laravel?

I am trying to build a user interface first by integrating a front-end framework that has Less and Sass files. However, I would also like to add or include a New CSS file that will contain additional classes.

Note: I don't want to compile the New CSS file via gulp or elixir. I just want to include it in my Master Blade file.

Should i include it inside Resources/Assets directory or inside Public directory?

Please let me know. Any help is appreciated

0 likes
8 replies
frezno's avatar
frezno
Best Answer
Level 36

Should i include it inside Resources/Assets directory or inside Public directory?
do you know what is the proper directory to place a custom css file?

if you don't want to compile and move it with eg Gulp, you should put it them to your public dir, eg
public -> assets -> css
public -> assets -> js

depending on the quantity or clear arrangement of css files you can break it down and use subdirectories as well, eg
... css -> less
... css -> sass
... css -> vendor
... css -> common
... css -> custom

martinbean's avatar

@Amidamaru If it’s a raw CSS file, place it in your public directory, and then link to it using the asset() helper. So if your CSS file is at public/css/custom.css, then in your Blade template:

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

Note: you don’t need to include “public” in the path.

4 likes
Drcensor's avatar

i have put the new css file and 1 placed it into the "resources/assets/sass/product.scss"

and also in the "webpack.mix.js file" "mix.sass('resources/assets/sass/product.scss', 'public/css');"

but when i use npm run dev in the commandline i get a error?

Karkotagan's avatar

Even after changing webpack.mix.js, I got error. I fixed the path for js files and images included in individual scss files and it compiled successfully

Tray2's avatar

@karkotagan Open a new thread to ask your question rather than highjacking a four year old thread.

2 likes

Please or to participate in this conversation.