I downloaded yuicompressor-2.4.8.jar and placed it in app/Resources/java/
folder.
Next I created the {% stylesheets %}
block in my twig template as in example below:
{% stylesheets
'bundles/arsen/css/style.css'
filter='cssrewrite, yui_css'
output='assets/css/complied.css'
%}
<link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}
When I run app/console assetic:dump
, I get this error:
"/usr/bin/java" "-jar" "C:\xampp\htdocs\Symfony27\app/Resources/java/yuicompressor-2.4.8.jar" "--charset" "UTF-8" "-o" "C:\Users\SYMFONY\AppData\Local\Temp\ass2341.tmp" "--type" "css" "C:\Users\SYMFONY\AppData\Local\Temp\ass2340.tmp"
Error Output:
The system cannot find the path specified.
As far I know, I have java jre installed and I have access to java from command line:
$ java -version
java version "1.8.0_73"
Java(TM) SE Runtime Environment (build 1.8.0_73-b02)
Java HotSpot(TM) Client VM (build 25.73-b02, mixed mode, sharing)
And in my windows path I have: C:\ProgramData\Oracle\Java\javapath registered This path points here:
Paths looks fine to me.
Does anyone know what is missing or where is the issue preventing app/console assetic:dump
command from working?
Perhaps this setting causes the issue app/config/config.yml
:
assetic:
#...
#java: /usr/bin/java
filters:
cssrewrite: ~
yui_css:
jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar"
#...
As stated by symfony documentation :
Windows users need to remember to update config to proper Java location.
In Windows7 x64 bit by default it's C:\Program Files (x86)\Java\jre6\bin\java.exe.
Actually, the command is looking for an executable located in /usr/bin/java
which doesn't exist on Windows.
Also, you have to register your java path in your assetic configuration :
assetic:
# ...
java: C:\Program Files (x86)\Java\jre7\bin\java.exe
See the YUI Compressor part of documentation.