Hello,
I created a template in which I am using a UI kit from Creative Tim. Now I am trying to turn this template into a Drupal theme, but I am having trouble with getting all the JS to work. I am getting the following errors in my console: https://imgur.com/7XFfOcC
Below is a structure of the CSS and JS files from my template, and then how I am including them in my theme.
In my head (CSS files):
<!-- Fonts and icons -->
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Lato:300,400,500,600,700,800,900|Material+Icons" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
<!-- CSS Files -->
<link href="./assets/css/material-kit.css?v=2.1.1" rel="stylesheet" />
<!-- Slick Slider CSS -->
<link href="./assets/css/slick.css" rel="stylesheet" />
<link href="./assets/css/slick-theme.css" rel="stylesheet" />
<!-- Custom CSS -->
<link href="./assets/css/custom.css" rel="stylesheet" />
In my footer (JS files):
<!-- Core JS Files -->
<script src="./assets/js/core/jquery.min.js" type="text/javascript"></script>
<script src="./assets/js/core/popper.min.js" type="text/javascript"></script>
<script src="./assets/js/core/bootstrap-material-design.min.js" type="text/javascript"></script>
<script src="./assets/js/plugins/moment.min.js"></script>
<!-- Plugin for the Datepicker, full documentation here: https://github.com/Eonasdan/bootstrap-datetimepicker -->
<script src="./assets/js/plugins/bootstrap-datetimepicker.js" type="text/javascript"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="./assets/js/plugins/nouislider.min.js" type="text/javascript"></script>
<!-- Google Maps Plugin -->
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY_HERE"></script>
<!-- Plugin for Tags, full documentation here: https://github.com/bootstrap-tagsinput/bootstrap-tagsinputs -->
<script src="./assets/js/plugins/bootstrap-tagsinput.js"></script>
<!-- Plugin for Select, full documentation here: http://silviomoreto.github.io/bootstrap-select -->
<script src="./assets/js/plugins/bootstrap-selectpicker.js" type="text/javascript"></script>
<!-- Plugin for Fileupload, full documentation here: http://www.jasny.net/bootstrap/javascript/#fileinput -->
<script src="./assets/js/plugins/jasny-bootstrap.min.js" type="text/javascript"></script>
<!-- Plugin for Small Gallery in Product Page -->
<script src="./assets/js/plugins/jquery.flexisel.js" type="text/javascript"></script>
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
<!-- Control Center for Material Kit: parallax effects, scripts for the example pages etc -->
<script src="./assets/js/material-kit.js?v=2.1.1" type="text/javascript"></script>
<!-- Slick Slider JS -->
<script src="./assets/js/slick.min.js" type="text/javascript"></script>
In my drupal theme, theme.libraries.yml:
global-styling:
css:
theme:
css/material-kit.min.css: {}
css/slick.css: {}
css/slick-theme.css: {}
css/custom.css: {}
js:
js/core/jquery.min.js: {}
js/core/popper.min.js: {}
js/core/bootstrap-material-design.min.js: {}
js/plugins/moment.min.js: {}
js/custom-scroll.js: {}
js/material-kit.min.js: {}
js/slick.min.js: {}
js/smooth-scroll.min.js: {}
js/custom.js: {}
dependencies:
- core/jquery
theme.info.yml:
name: "Verdamigo"
description: "Verdamigo template"
type: theme
core: 8.x
base theme: classy
libraries:
- verdamigo/global-styling
regions:
primary_menu: 'Primary menu'
header: 'Header'
sidebar_first: 'Sidebar first'
content: 'Content'
footer: 'Footer'
I guess maybe my problem has to do with the core drupal javascript files not being loaded, or loaded too early or too late?
Thanks in advance,
Mike
Comments
try these dependencies, see
try these dependencies, see if anything improves