If you developing a Drupal 8 custom theme and notice the following CSS and JavaScript files are added automatically by Drupal, and you want to remove it .
CSS file
<link rel="stylesheet" href="/core/themes/stable/css/system/components/ajax-progress.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/align.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/autocomplete-loading.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/fieldgroup.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/container-inline.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/clearfix.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/details.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/hidden.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/item-list.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/js.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/nowrap.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/position-container.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/progress.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/reset-appearance.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/resize.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/sticky-header.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/system-status-counter.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/system-status-report-counters.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/system-status-report-general-info.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/tabledrag.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/tablesort.module.css?owah24" media="all" />
<link rel="stylesheet" href="/core/themes/stable/css/system/components/tree-child.module.css?owah24" media="all" />
JavaScript File
<script src="https://use.fontawesome.com/releases/v5.13.1/js/all.js'"></script>
<script src="core/misc/progress.js"></script>
<script src="core/misc/displace.js"></script>
Use below code for removing Stylesheet and JavaScript File
in custom_theme.info.yml add below line
For removing Stylesheet
libraries-override:
system/base: false
OR
stylesheets-remove:
- core/modules/system/css/components/ajax-progress.module.css
- core/modules/system/css/components/align.module.css
- modules/ajax_loader/css/throbber-general.css
- core/modules/system/css/components/autocomplete-loading.module.css
- core/modules/system/css/components/fieldgroup.module.css
- core/modules/system/css/components/clearfix.module.css
- core/modules/system/css/components/details.module.css
- core/modules/system/css/components/item-list.module.css
- core/modules/system/css/components/js.module.css
- core/modules/system/css/components/nowrap.module.css
- core/modules/system/css/components/container-inline.module.css
- core/modules/system/css/components/position-container.module.css
- core/modules/system/css/components/progress.module.css
- core/modules/system/css/components/reset-appearance.module.css
- core/modules/system/css/components/resize.module.css
- core/modules/system/css/components/sticky-header.module.css
- core/modules/system/css/components/system-status-counter.css
- core/modules/system/css/components/system-status-report-counters.css
- core/modules/system/css/components/tabledrag.module.css
- core/modules/system/css/components/tree-child.module.css
- core/modules/contextual/css/contextual.module.css
- modules/select2boxes/css/select2boxes.theme.css
- core/modules/views/css/views.module.css
- core/modules/system/css/components/system-status-report-general-info.css
- core/modules/system/css/components/tablesort.module.css
- core/assets/vendor/jquery.ui/themes/base/core.css
- core/assets/vendor/jquery.ui/themes/base/checkboxradio.css
- core/assets/vendor/jquery.ui/themes/base/controlgroup.css
- core/assets/vendor/jquery.ui/themes/base/resizable.css
- core/assets/vendor/jquery.ui/themes/base/button.css
- core/assets/vendor/jquery.ui/themes/base/dialog.css
- core/modules/contextual/css/contextual.theme.css
- core/modules/contextual/css/contextual.icons.theme.css
- core/assets/vendor/jquery.ui/themes/base/theme.css
For JavaScript
in theme.theme file use below code
function custometheme_js_alter(&$js) {
unset($js['https://use.fontawesome.com/releases/v5.13.1/js/all.js']);
unset($js['core/misc/progress.js']);
unset($js['core/misc/displace.js']);
//unset($js['themes/aeg/js/core.js']);
//echo "<pre>";
//print_r($js); die;
}
No comments:
Post a Comment