logo

Add External CSS in Drupal 8

30
April

Add External CSS in Drupal 8
By: Anonymous | Published On: Fri, 04/30/2021 - 11:15

How can add externalcss in Drupal 8 ?

Post following format in libraries.yml, for example my theme name is customtheme so the file will be 'customtheme.libraries.yml'  in theme folder

css:
    theme:
      'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css': { type: external, minified: true }
      'https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,400;0,700;1,400;1,700&display=swap': { type: external, minified: true }
      'https://fonts.googleapis.com/css?family=Montserrat:300,400,500,600,700|Open+Sans:400,600,700': { type: external, minified: true }
      'https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css': { type: external, minified: true }

Need Help ?