Why aren't PHP files used for (custom) CSS and JS?

后端 未结 8 1118
旧时难觅i
旧时难觅i 2020-12-15 22:27

Why don\'t people make .php files for their CSS and JavaScript files?

相关标签:
8条回答
  • 2020-12-15 23:12

    Sometimes you might have to dynamically create javascript or styles.

    the issue is webservers are optimized to serve static content. Dynamically generating content with php can be a huge perforamce hit because it needs to be generated on each request.

    0 讨论(0)
  • 2020-12-15 23:12

    PHP is often used as a processor to generate dynamic content. It takes time to process a page and then send it. For the sake of efficiency (both for the server and time spent in programming) dynamic JS or CSS files are only created if there isn't a possible way for the static file to successfully accomplish its intended goal.

    I recommend only doing this if absolutely you require the assistance of a dynamic, database driven processor.

    0 讨论(0)
提交回复
热议问题