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

lifesound's avatar

npm or link , including for css or/and js

What's the best approach to include js / css

cdns give the advantage of cashing , while npm give us many pros ?

0 likes
1 reply
KNietzsche's avatar
Level 17

npm will help you to merge/build the final compacted files (css and/or js) from your original files that you will link for production but if you want to test, you can use link to the cdn of course, before to build the final version with npm npm is a tool that will generate the file to link in your page in dev (for debug...) or production mode. With npm, your file is locally based, so faster to upload as well.

Please or to participate in this conversation.