Compressing JS code with regular PHP code using preg_replace
(). Replacing the properties and methods of objects with their abbreviated names everywhere except in those parts of the code where a literal object is transferred to one of the methods of the animation object (the properties of the desired literal object cannot be replaced, since their values ​​are later transferred to the corresponding properties of the element's house) .
Conditional JS code fragment:
App.func.animation.animateDomElement(document.getElementById("container"), { height: 0 }, 300, q); var newObj = { height: 120 };
In this example, in the substring " var newObj={height:0};
" the height property of the object must be replaced with the new name, and in the literal object that is passed by the parameter to the function, the property must remain "as is".
The second day I struggle with this task, I can’t think of anything.
PS: in the JS code prepared for regular processing, of course, there will be no extra spaces, no tabs, no line breaks.