pilif / sacy

Smarty Asset Compiler (warning: all branches but master are subject to force pushes)
http://pilif.github.com/sacy
MIT License
34 stars 12 forks source link

Sacy not working after manual install #23

Open LucusWebsites opened 9 years ago

LucusWebsites commented 9 years ago

First of all I would really love this piece of code once I get it working.

Buf for some reason I can't get it to work, I am using PHP 5.4.26 I installed sacy this way:

Files:
/lib/smarty/plugins/block.asset_compile.php
/lib/smarty/plugins/sacy/coffeescript.php
/lib/smarty/plugins/sacy/cssmin.php
/lib/smarty/plugins/sacy/ext-translators.php
/lib/smarty/plugins/sacy/fragment-cache.php
/lib/smarty/plugins/sacy/jsmin.php
/lib/smarty/plugins/sacy/phpsass.php
/lib/smarty/plugins/sacy/sacy.php

And defined the two required contanst.

I added a couple of line in block.assect_compile.php:

<?php

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'sacy.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'phpsass.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'fragment-cache.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'cssmin.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'coffeescript.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'ext-translators.php')));

if (!defined("____SACY_BUNDLED"))
    include_once(implode(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'sacy', 'jsmin.php')));

if (!(defined("ASSET_COMPILE_OUTPUT_DIR") && defined("ASSET_COMPILE_URL_ROOT"))){
    throw new sacy\Exception("Failed to initialize because path configuration is not set (ASSET_COMPILE_OUTPUT_DIR and ASSET_COMPILE_URL_ROOT)");
}

function smarty_block_asset_compile($params, $content, &$template, &$repeat){
    if (!$repeat){
...

In my smarty base.tpl I wrapped the CSS and JS-files with the {asset_compile} tags, but the files are not merged and the websites throws a lot of notices:

Notice: Undefined index: merge_tags in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/sacy/sacy.php on line 246 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Uninitialized string offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 62 
Notice: Undefined offset: 0 in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 84 
Notice: Undefined variable: res in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/block.asset_compile.php on line 133 
Notice: Undefined index: block_ref in /var/www/html/--hidden--/htdocs/site/lib/smarty/plugins/sacy/sacy.php on line 213

Any idea what can be the issue?