0

I have to build a webservice in order to send a webpage to some others websites. Theses websites will integrate this webpage inside another one.

I have to send the assets separetely from the webpage. For performances issues, I musn't use AJAX requests.

One of my javascript files, need businness data in order to display and validate form fields according to complex business rules (Administration).

So far I'm using a "js.twig" template, so I can easily add my data to my script.

However, I'm asked to minify this file (performance and intellectual property). How can I minify my file "on the fly" ?

Update :

I'm not asking for a tool. I already have one. I need leads about calling a "minifyier on the fly". Filo gave a pretty good on the subject.

1
  • I'm voting to close under the "recommend or find a tool" reason, because the answer to this question is to find a server-side minifier. Commented Jul 10, 2014 at 17:24

1 Answer 1

3

probably this answer can help you: https://stackoverflow.com/a/15947488/3625883

If you want a library in pure php to perform the compression, you can use https://code.google.com/p/minify/

For installation: add in composer.json

 "mrclay/minify": "2.2.0"

Then you can use Assetic filter: jsminplus (https://github.com/jbroadway/assetic/blob/master/lib/JSMinPlus.php )

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.