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

psyopus's avatar

laravel-mix + git, what to put in gitignore?

I watched the episodes on laravel-mix but something is not mentioned.

what to put in .gitignore when using laravel-mix with git.

i was thinking based on something like this:

mix
    .js('resources/assets/js/app.js', 'public/js')
    .js('resources/assets/js/portal.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css') 
    .sass('resources/assets/sass/portal.scss', 'public/css');

i should just add "public/js" and "public/css" to gitignore and then add something to my production deploy script like:

npm run production

would that suffice for production enviroment?

any other pitfalls i should consider?

0 likes
2 replies
nikhil_webfosters's avatar

@psyopus : Yes this a good solution, I don't see any downside.

I see it was 3 months, so what did you end up doing? Noticed any downside with the above?

psyopus's avatar

@nikhil_webfosters

this seems to work:

/node_modules
/public/hot
/public/storage
/public/js
/public/css
/storage/*.key
/vendor
.env

deploy.sh
nbproject
.directory
_ide_helper.php

Please or to participate in this conversation.