2 Setup and configuration - skyshab/rootstrap-screens GitHub Wiki
Bind the Rootstrap Screens Manager within a Hybrid\Tools\ServiceProvider class.
Example Provider:
<?php
use Hybrid\Tools\ServiceProvider;
use Rootstrap\Rootstrap;
use Rootstrap\Devices\Manager as RootstrapDevices;
use Rootstrap\Screens\Manager as RootstrapScreens;
/**
* Rootstrap service provider.
*
* @since 1.0.0
* @access public
*/
class RootstrapProvider extends ServiceProvider {
/**
* Register classes and bind to the container
*
* @since 1.0.0
* @access public
* @return void
*/
public function register() {
/**
* Rootstrap Core
*/
$this->app->singleton( 'rootstrap',
new Rootstrap()
);
/**
* Devices Manager
*/
$this->app->singleton( 'rootstrap/devices',
new RootstrapDevices()
);
/**
* Screens Manager
*/
$this->app->singleton( 'rootstrap/screens',
new RootstrapScreens(
// Devices collection
$this->app->resolve('rootstrap/devices')->collection()
)
);
}
/**
* Boot Modules
*
* @since 1.0.0
* @access public
* @return void
*/
public function boot() {
$this->app->resolve('rootstrap')->boot();
$this->app->resolve('rootstrap/devices')->boot();
}
}
The Roostrap\Screens\Manager class accepts a Devices Collection to build screens from.
Screens are generated for every possible combination of devices, and assigned plain English designations.
For example, with the default devices of "mobile", "tablet" and "desktop", the following screens would be generated:
- mobile
- tablet
- tablet-and-under
- tablet-and-up
- desktop
Each screen will have corresponding "min" and "max" values. A Collection of screens can be accessed with the Rootstrap\Screens\Manager::collection() method. This can be then used in the creation of a Rootstrap\Styles Collection.