Support » Plugin: Simple Lightbox » Move core css to footer

  • Resolved gavo

    (@gavo)


    Hello,

    i successfully try modify part of your code to get core css to footer, because is not nesessary in header.

    	/**
    	 * Declare client files (scripts, styles)
    	 * @uses parent::_client_files()
    	 * @return void
    	 */
    	protected function _client_files($files = null) {
    		$js_path = 'client/js/';
    		$js_path .= ( SLB_DEV ) ? 'dev' : 'prod';
    		$files = array (
    			'scripts' => array (
    				'core'			=> array (
    					'file'		=> "$js_path/lib.core.js",
    					'deps'		=> 'jquery',
    					'enqueue'	=> false,
    					'in_footer'	=> true,
    				),
    				'view'			=> array (
    					'file'		=> "$js_path/lib.view.js",
    					'deps'		=> array('[core]'),
    					'context'	=> array( array('public', $this->m('is_request_valid')) ),
    					'in_footer'	=> true,
    				),
    			),
    			'styles' => array (
    				'core'			=> array (
    					'file'		=> 'client/css/app.css',
    					'context'	=> array('public'),
    					'in_footer'	=> true, //this
    				)
    			)
    		);
    		parent::_client_files($files);
    	}

    I Add 'in_footer' => true, //this to your files structure and works well. Can you add this to next release? Or do you have any reason to add css to header?

    • This topic was modified 2 years, 10 months ago by gavo. Reason: Code part
    • This topic was modified 2 years, 10 months ago by gavo. Reason: Title edit
Viewing 1 replies (of 1 total)
  • Plugin Author Archetyped

    (@archetyped)

    Hi, the app.css is loaded in the page’s head because it may include rules that would result in a FOUC if the styles are added in the footer.

    The goal is to move as much as possible to the footer, so future optimizations may allow for this.

    Thanks.

Viewing 1 replies (of 1 total)
  • The topic ‘Move core css to footer’ is closed to new replies.