V
V
Vlad Tokarev2016-06-28 16:41:43
Yii
Vlad Tokarev, 2016-06-28 16:41:43

Why does Laravel Elixir create files with hashes in public/build/assets (much like in Yii)?

Let's say we create a file in laravel-elixir in public/assets/some.css.
This creates a copy of this file in public/build/assets/some-filehash.css, which is called from the view when using elixir('assets/some.css').
It is not clear how this is better than the option if it were elixir('assets/some.css')given away public/assets/some.css?v=filehash.
Approximately similar situation in Yii.
Why make copies of files if you can add a parameter to the css files in the view so that the old version is not taken from the cache?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Tokarev, 2016-06-29
@Vadiok

In general, there are several advantages to separate files over adding a get parameter to 1 file:

  1. If an html page is cached, for which the layout and styles are changing, then old files will be given for the old version, new ones for the new one. In the case of the get parameter, the old layout will be given a new stylesheet or js file, which may not be compatible with the old markup.
  2. Some proxy servers cache statics without taking into account get parameters - at the moment, most likely the problem is not relevant
  3. Problems when separate servers are used for statics due to out-of-sync layout and statics

T
Tesla, 2016-06-28
@Tesla

Static can be served by nginx and it can be done very quickly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question