Hi guys,
I’ve been working on a project for quite some times now. I’m almost ready to go in production but before I would like to minified my css and js. I’ve already passed way too much time for something I thought would be easy. I’ve read sections “Combining and Compressing Assets” and “Using the asset Command” in the Assets page of the guide.
To understand how the yii asset command works I’m trying to combine and compress only the yii\web\YiiAsset bundle:
'bundles' => [
'yii\web\YiiAsset',
],
It runs but the js output file is empty and the google tool closure compiler shows a lot of parse errors:
Loading configuration from 'assets.php'...
Collecting source bundles information...
Creating output bundle 'all':
Compressing JavaScript files...
.../branches/dev/frontend/web/js/all-temp.js.tmp:8243: ERROR - Parse error. missing name after . operator
if ( conv && s.throws ) {
^
.../branches/dev/frontend/web/js/all-temp.js.tmp:8244: ERROR - Parse error. syntax error
response = conv( response );
^
.../branches/dev/frontend/web/js/all-temp.js.tmp:8263: ERROR - Parse error. missing ) after argument list
jQuery.extend( {
^
.../branches/dev/frontend/web/js/all-temp.js.tmp:8263: ERROR - Parse error. syntax error
jQuery.extend( {
Since YiiAsset depends on JqueryAsset it also tries to compress jquery. I think these errors are the cause of the empty output js file.
So I have two questions:
[list=1]
[*]How to make it works with jquery?
[*]Can I use jquery.min.js instead of trying to compress jquery.js? If so how do I configure asset command to skip JqueryAsset?
[/list]
I’m using the advanced template and I’m new to closure compiler.
Thanks.