I am creating a new theme for Magento 2 to be used inhouse as a basetheme for new projects. I am basing it on "Zurb Foundation for sites" and this boilerplate includes js files what-input.js, jquery.js and foundation.js:
i have created foundation.js as such:
define([
'jquery',
'what-input'
],function($) {
'use strict';
$(function() {
$(document).foundation();
});
});
And what-input.js also has the same setup with define depending on jquery only. Am i doing this the right way? Will magento recognize what-input.js as a js module and load it when foundation.js is loaded? Also, how do i tell magento to load foundation.js?
These files are in theme_folder/web/js next to responsive.js and theme.js which both loads properly as far as i can tell.
EDIT:
Solved the issue i described in the comment by replacing the JS:
"*": {
"Mage2theme/js/foundation": {}
}
With:
{
"*": {
"Mage2theme/js/foundation": {}
}
}
But another problems arose, it does not copy the foundation.js file to pub/stacic theme folder so i get a 404 when trying to load it.