Generate Javascript file with PHP

My current code =============== I have started writing an API that loads, minifies and returns javascript files into one file using PHP. This is achieved by pointing to a PHP file from a `script` tag in HMTL like so: This `jsapi.php` page processes the javascript files and outputs the minified javascript, with the header: header("Content-Type: text/javascript"); My Question =========== Is this a bad method to load javascript files? Would it be **much** faster and reliable to load the javascript files individually by simply pointing to the `.js` file in the `src` attribute? If you wish to see my code for the the full API, have a look at [this][1]. The mentioned link also explains in detail what it is I am doing and why. [1]:
Nothing bad. Loading together speeds up your web application. You'd better hide your php file as js, this can be done with .htaccess

以上就是Generate Javascript file with PHP的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准