Packing, caching, JS and CSS in PHP that differentiate between development and production environment

前端 未结 3 781
-上瘾入骨i
-上瘾入骨i 2021-01-30 05:54

I am trying to make development easy and have highly optimized output in production.

The goals of what I am trying to do is:

3条回答
  •  滥情空心
    2021-01-30 06:21

    Great Question!

    I've worked with a process with similar requirements, but we took somewhat of a different approach. I realise its maybe not exactly what you're after, but would still make some recommendations:

    1. Make the compression/compilation part of the shipping process.(You may already be doing this, but it wasn't clear from the above).
    2. Compress/compile it on the development servers too. It might be a hassle for debugging/testing but you want to be able ensure the production version and test versions are as similar as possible. If you have the luxury of multiple development stages, then you could possibly compress on one of them.
    3. Only do the compression/compilation if it passes some sort of quality scan (e.g. jslint)
    4. Don't combine the modules - keep them separate. The performance benefits you will gain will be so negligible, as to be almost pointless.
    5. Don't change the HTML, just change the dependant modules content.

    I realise its a bit different from what you were intending, but in my experience it leads to a more robust development promotion model.

提交回复
热议问题