Javascript / CSS Location files for development branch and manufacturing industry

I set up my web server, for the most part to keep track of the overall git / web-based workflow .

So, I have a dev branch in the same folder as a subdomain and a main branch in my root folder / domain.

The problem is that during production we merge and minimize the master js / css master files and put them in our cdn, and every time we change and reduce the files, the file name changes, so our main branch ends with a link to something like cdn.example.com/e23ab9.js, and that of course changes as often as we update the code.

But then in our version and development branch, of course, we just want to refer to unrelated and non-minified files so that we can constantly test new modifications.

I am sure that there is a reasonable / optimized way to solve this situation, so we do not constantly go back and forth between raw js / css files and the newly created mini file name every time we update our production version with the latest version.

I think the solution may include symbolic links or something like that, but I am not very familiar with them and prefer to study it and do it from the very beginning.

Any suggestions, tips or guidance are appreciated.

Thank you all

+4
source share
1 answer

jstats, we control a similar setting and, according to your comment, it makes sense.

Repeat what I think you decided to do in this case -

  • Most likely, you compress and merge your files, creating a dynamic & random file name that is sent to the CDN.
  • [long guessing snapshot here ..] - you somehow notice on the server (maybe a file like a PID file, but contains a randomized file name), which you can capture during rendering to point to the CDN file.
  • When rendering, you check with your code on the server side whether you work in production or in development. 3a. If you are manufacturing, take your "PID" file and point to the CDN 3b mini file. If development, download all regular resources

This requires a leap of assumption, but I saw this implementation before, so I went with it: -p

Answer your question regarding a more ordered version:

Yes, one great way to simplify this is through something like the Google Pagespeed Module

Then just configure the virtual hosts for your production installation, to let Pagespeed do its work and set up development, turn off the Pagespeed feature!

In the end, it is relatively simple.

I am sure that you have moved, but in case someone finds this question and is looking for an answer.

+1
source

All Articles