Assets::frontend( $container )

Summary

No summary available.

Source

File: src/BigCommerce/Container/Assets.php

	public function frontend( Container $container ) {
		$container[ self::FRONTEND_SCRIPTS ] = function ( Container $container ) {
			return new Theme\Scripts( $container[ self::PATH ], $container[ self::VERSION ], $container[ self::FRONTEND_CONFIG ], $container[ self::FRONTEND_LOCALIZATION ] );
		};

		$container[ self::FRONTEND_STYLES ] = function ( Container $container ) {
			return new Theme\Styles( $container[ self::PATH ], $container[ self::VERSION ] );
		};

		$container[ self::FRONTEND_CONFIG ] = function ( Container $container ) {
			return new Theme\JS_Config( $container[ self::PATH ], new Connections() );
		};

		$container[ self::FRONTEND_LOCALIZATION ] = function( Container $container ) {
			return new Theme\JS_Localization();
		};

		$container[ self::IMAGE_SIZES ] = function ( Container $container ) {
			return new Theme\Image_Sizes();
		};

		add_action( 'after_setup_theme', $this->create_callback( 'frontend_after_setup_theme', function () use ( $container ) {
			$container[ self::IMAGE_SIZES ]->register_sizes();
		} ), 10, 0 );

		add_action( 'wp_enqueue_scripts', $this->create_callback( 'frontend_wp_enqueue_scripts', function () use ( $container ) {
			$container[ self::FRONTEND_SCRIPTS ]->enqueue_scripts();
			$container[ self::FRONTEND_STYLES ]->enqueue_styles();
		} ), 10, 0 );
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.