Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #1083618

    I install my sites using bedrock from roots.io and have a problem with the theme when the assets are being built.

    Here is an example of error from the asset manager class:
    Warning: file_get_contents(/var/www/site.com/public/wp/http://site.com/app/themes/enfold/css/base.css): failed to open stream: No such file or directory in /var/www/site.com/public/app/themes/enfold/config-templatebuilder/avia-template-builder/php/asset-manager.class.php on line 328

    when running $this->set_path($enqueued->registered[$file]->src), site_url() is being used to find the url in the asset file, however the site_url contains /wp when all the asset files live under the app folder. In addition to this, if I change the code to use the home_url() the path will be correct, however, the file_get_contents is still incorrect as theABSPATH for wp is set to /wp.

    Every time I update enfold I have to manually make this change again and create a new minor version on my repo which sucks. :(

    Is there a possibility that you could either give me a filter to work with to write my own custom replacement method for the $data array on line 264 / the file get contents path on line 332?

    • This topic was modified 5 years, 8 months ago by Vince.
    #1085162

    Hey Vince,
    Sorry for the late reply, I am forwarding your request to the dev team. I believe they are working on an issue with the paths now, but I couldn’t say if this will help you in the future, so I’ll ask them to comment.
    Thank you for your patience.

    Best regards,
    Mike

    #1085439

    Hi!

    I added filter avf_asset_mgr_get_file_data.

    Please check https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_4_5_5/Filter_asset_manager/asset-manager.class.php.

    Does that help you?
    If you need more parameters let us know.
    Is In the pull requests for the next update.

    Needs 4.5.5

    Regards,
    Günter

    #1086030

    hey Günter the one you posted here in this thread : https://kriesi.at/support/topic/again-one-problem-with-merged-css/
    has worked perfectly – but the new on github does not work in that way – again the merged urls are wrong

    this one you posted me on that topic before works:
    https://pastebin.com/q8eXS3aR

    #1086478

    Hi,

    @Vince

    I added 2 more filters: avf_asset_mgr_get_file_data and avf_compress_file_content_path


    @Guenni007

    These are 2 different things.

    The filters in this topic refer to the files to be compressed – this actually should work fine but Vince asked for filters to build his own replacements.

    The other replacements are done for the dynamic css file (links to images).

    Best regards,
    Günter

    #1086482

    You guys are magic!

    Thank you so much. I will run through all of this at the weekend and send feedback.
    I did run into a problem the other day with my hook where it was throwing errors with google captcha CSS :( – will investigate.

    #1086615

    @Günter : I’m already aware of this, but should we now handle two versions of a temp fix? Would a file that has the fix in it for both purposes be better?

    #1086642

    Hi,


    @guenni007

    Kriesi is planning a release probably next week – and for testing purpose I wanted to keep this seperate. If I get the OK and Kriesi does not make a release at beginning of next week I will merge the 2 fixes into 1.

    IMO this fix here is not really needed by many users.

    Best regards,
    Günter

    #1115614

    Hi Guys,

    I’ve bought the Enfold theme (4.5.7) today. And if I use the theme child (with Bedrock too) the errors (reported above) appear. Can you fix that? I need to use the theme child for customize some things.

    Tks a lot.

    #1115615

    Just an update.

    It occurs with the main theme too.

    #1115708

    Hi,

    @ishigami

    Thank you for using Enfold.

    The filter avf_asset_mgr_get_file_data is included in 4.5.7 (enfold\config-templatebuilder\avia-template-builder\php\asset-manager.class.php around line 278).

    I do not know what bedrock is exactly doing – and we do not support this plugin. So this is customization and out of scope of support.
    In case you need an additional filter you can let us know and we can check if it is possible to add to core.

    You can contact the plugin author and ask for assistance there – or hire a freelancer.

    Best regards,
    Günter

    #1116523

    Hi Günter,

    First of all, thanks for your response.

    And just one question, how I use this filter? Do I need to change it on my functions.php (in the child theme)? Or I need to change in the asset-manager.class.php file directly?

    Tks.

    #1116619

    Hi,

    You can (should) us filters in the functions.php of your child theme – than you need not think about when theme updates of the parent theme are coming.

    Best regards,
    Günter

    #1116685

    Hi Günter,

    Can you post an example please? I think that it can be useful for other people that are using this wonderful theme with bedrock.

    Thanks a lot,

    Kan

    #1116713

    Hi,

    I added the frame how to add the filter to functions.php and an dummy example:

    https://github.com/KriesiMedia/enfold-library/blob/master/actions%20and%20filters/Performance/avf_asset_mgr_get_file_data.php

    You have to check with bedrock what exactly needs to be changed.

    Best regards,
    Günter

    #1117058

    Hi Günter,

    Thanks a lot. It worked smoothly.

    I’ll put the code below for future reference:

    
    // functions.php
    
    /**
     * Allows to alter $data content like:
     * 	- path
     * 	- url
     *
     * @since 4.5.6
     * @param array $data
     * @param int $enqueued_to_do_index		$enqueued->to_do index
     * @param string $file_type				'js' | 'css'
     * @param string $file_group_name		'avia-head-scripts' | 'avia-footer-scripts' | 'avia-merged-styles'
     * @param WP_Scripts $enqueued
     * @param array $conditions
     */
    function custom_asset_mgr_get_file_data( array $data, $enqueued_to_do_index, $file_type, $file_group_name, WP_Scripts $enqueued, array $conditions )
    {
    	
    	/**
    	 * This is only an example how to alter the path to a file.
    	 * Make sure to add the correct path otherwise merging will fail
    	 */
    	$file = $enqueued->to_do[ $enqueued_to_do_index ];
    	$key = $file . '-' . $file_type;
    	
    	if( 'avia-compat-js' == $key )
    	{
    		$new_path = str_replace(HOME_URL, '', $data['remove'][ $key ]['path']);	// enter your changed path here  !!!!
    		$data['remove'][ $key ]['path'] = $new_path;
    	}
    	
    	/**
    	 * ******************   End of example   ***********************
    	 */
    	return $data;
    }
    						
    add_filter( 'avf_asset_mgr_get_file_data', 'custom_asset_mgr_get_file_data', 10, 6 );
    
Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.