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

alex_time's avatar

Assets production compile best practice

I usually compile assets using --production filter on dev machine and then commit end deploy. This requires that I have to commit again on dev machine only to get back debug on my assets locally. I am wondering if this is a good practice or if someone tends to compile assets on production server after commit and not locally, having the insurance that assets are always compiled as "production" on production server and without requiring a double compile on dev machine. Compiling on production server although could bring to some issue due to different npm or node version? What do you think?

0 likes
4 replies
Sti3bas's avatar

@alex_time I'm compiling my assets on server during deployment and I haven't had any issues.

simioluwatomi's avatar

I versioned assets in a project at work... Turned out to be a huge mistake as I had to run production task when finishing a feature before merging into to master (because I didn't want those kinds of commits on master).

On my new side project, assets are not versioned but would be built during deployment steps on the server. I think things are much cleaner that way.

Please or to participate in this conversation.