Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem with move_raw option #118

Open
countless-integers opened this issue Dec 12, 2014 · 6 comments
Open

problem with move_raw option #118

countless-integers opened this issue Dec 12, 2014 · 6 comments

Comments

@countless-integers
Copy link

I want to use the move_raw option to copy images and fonts to public dir from module's asset directories, however I get a fatal from Assetic:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'There is no "flexslider_fonts" asset.' in /path/to/project/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php on line 37

My asset collection config:

                 'flexslider_fonts' => array(                                                                    
                     'assets' => array(                                                                       
                         'fonts/flexslider-icon.svg',                                                         
                         'fonts/flexslider-icon.woff',                                                        
                         'fonts/flexslider-icon.ttf',                                                         
                     ),                                                                                       
                     'options' => array(                                                                      
                         'move_raw' => true,                                                                  
                     ),                                                                                       
                 ),

Weird thing is the assets do get moved to public/fonts but I get the fatal after that. Tried the same thing with images. Any suggestions?

I'm using the latest stable release on a zf2 2.3.1

@widmogrod
Copy link
Owner

Could it be that you have name mismatch?
galeria_fonts should be flexslider_fonts

Or other way around.

@countless-integers
Copy link
Author

My bad, I've made a mistake pasting the code (corrected now). Anyway the names are fine, as far as I can tell. I even tried to change and reorder them (hence the mismatch in the code samples I pasted -- each from a run with different asset collection names).

@widmogrod
Copy link
Owner

I you could paste:

  • full stack trace
  • whole assetic_configuration

@countless-integers
Copy link
Author

Ok, I had to redact it a bit (company policy), but it've tried to keep it relevant. First, config:

return array(
    'assetic_configuration' => array(
        'webPath' => realpath('public'),
        'cachePath' => realpath('data/assetic'),
        'basePath' => 'p',
        'default' => array(
            'assets' => array(
                '@common_front_css',
                -100 => '@head_common_js',
            ),
            'options' => array(
                'mixin' => true,
            ),
        ),
        'rendererToStrategy' => array(
            'Zend\View\Renderer\PhpRenderer' => 'Zend\View\Renderer\PhpRenderer',
        ),
        'debug' => true,
            'buildOnRequest' => true,
            'cacheEnabled' => false,
            'combine' => false,
            'baseUrl' => $host,
        ),
        'routes' => array(
            // ...
            'article/content' => array(
                '@head_front_js',
                '@search_js',
                '@flexslider_js',
                '@flexslider_css',
                '@flexslider_fonts',
            ),
            // ...
        ),
        'modules' => array(
            'Article' => array(
                'root_path' => realpath('module/Article/assets/'),
                'collections' => array(
                    'flexslider_js' => array(
                        'assets' => array(
                            'js/vendor/jquery.flexslider.js',
                            'js/ligthbox.js',
                        ),
                        'options' => array(
                            'output' => 'js/combined/gallery.js'
                        ),
                        'filters' => array(
                            '?YUIJsCompressor',
                        ),
                    ),
                    'flexslider_css' => array(
                        'assets' => array(
                            'css/vendor/flexslider.css',
                        ),
                        'options' => array(
                            'output' => 'css/combined/gallery.css'
                        ),
                        'filters' => array(
                            '?YUICssCompressor',
                        ),
                    ),
                    'flexslider_fonts' => array(
                        'assets' => array(
                            'fonts/flexslider-icon.svg',
                            'fonts/flexslider-icon.woff',
                            'fonts/flexslider-icon.ttf',
                        ),
                        'options' => array(
                            'move_raw' => true,
                        ),
                    ),
                ),
            ),
        ),
    ),
);

And the stacktrace:

PHP Fatal error:  Uncaught exception 'InvalidArgumentException' with message 'There is no "flexslider_fonts" asset.' in /redacted/path/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php:37
Stack trace:
#0 /redacted/path/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Service.php(315): Assetic\AssetManager->get('galeria_img')
#1 /redacted/path/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Service.php(250): AsseticBundle\Service->setupRendererFromOptions(Object(Zend\View\Renderer\PhpRenderer), Array)
#2 /redacted/path/vendor/widmogrod/zf2-assetic-module/src/AsseticBundle/Listener.php(79): AsseticBundle\Service->setupRenderer(Object(Zend\View\Renderer\PhpRenderer))
#3 [internal function]: AsseticBundle\Listener->renderAssets(Object(Zend\Mvc\MvcEvent))
#4 /redacted/path/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array in /redacted/path/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php on line 37

BTW. are other types of assets supported, besides collections? Like a single file asset?

@widmogrod
Copy link
Owner

It's look like it crash when try to get('galeria_img') but I don't see this configuration here.

Hard to say where lies the problem.

If you could write a test, that reproduce this error and create a pull request.
That would help to debug it.

@stephaun
Copy link
Contributor

I have been having this same issue for months. Like countless-integers has said, the assets get moved regardless, so the temporary workaround is to just comment image/font assets:

'default' => array(
    'assets' => array(
        //'@font_awesome_fonts',
        '@font_awesome_css',
        '@jquery',
        //'@bootstrap_fonts',
        '@bootstrap_css',
        '@bootstrap_js',
        //'@jquery_ui_img',
        '@jquery_ui_css',
        '@jquery_ui_js',
    ),
),

Will try and come up with a fix in my free time...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants