3

Is it possible to exclude a specific css or js from drupal'l css and js aggregation ?

For ex: Exclude custom-style.css from being aggragated ?

11

Similar to Drupal 7, the setting preprocess key to FALSE will prevent a JS or CSS library from being aggregated.

mylibraryname:
  css:
    theme:
      css/custom-style.css: {preprocess: false}

Same works for JavaScript

cuddly-slider:
  version: 1.x
  js:
    js/cuddly-slider.js: {preprocess: false}
  dependencies:
    - core/jquery
    - core/drupalSettings

As documented on Adding stylesheets (CSS) and JavaScript (JS) to a Drupal 8 module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.