Remove a contrib module stylesheet in Drupal 8 theme


You’ll need to add the following to your info.yml, yes, not to libraries.

stylesheets-remove:
– ‘@module_name/path/to/your/file.css’

Advertisements

Drupal 8 is admin path


To check the path of the current page:

$is_admin = \Drupal::service('router.admin_context')->isAdminRoute();

to check an arbitrary path, you need to create a Request object and obtain its matching Route:

use Symfony\Component\HttpFoundation\Request;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;

$path = '/node/1';
$request = Request::create($path);

$route_match = \Drupal::service('router.no_access_checks')->matchRequest($request);
$route = $route_match[RouteObjectInterface::ROUTE_OBJECT];
$is_admin = \Drupal::service('router.admin_context')->isAdminRoute($route);

 

via: https://api.drupal.org/comment/60024#comment-60024