I am looking to import a file that brings in another file for use across multiple pages
Here is my folder structure:
js
modules
momentum-scrolling
index.js
about.js
contact.js
Contents of momentum-scrolling.js:
import LocomotiveScroll from 'locomotive-scroll';
export const scroll = new LocomotiveScroll({
el: document.querySelector('[data-scroll-container]'),
smooth: true
});
Contents of index.js:
import './modules/momentum-scrolling'
window.addEventListener('DOMContentLoaded', () => {
// some code
});