I'm new to Mean.io and I'm trying to aggregate an external .js file to my package but I'm doing it wrong because it is not being added to aggregated.js.
This is what I've done:
importer.register(function(app, auth, database) {
importer.aggregateAsset('js', 'xml2json.min.js');
//We enable routing. By default the Package Object is passed to the routes
importer.routes(app, auth, database);
//We are adding a link to the main menu for all admin users
VavelImporter.menus.add({
title: 'importer example page',
link: 'importer example page',
roles: ['admin'],
menu: 'main'
});
return importer;
});
The important line is: importer.aggregateAsset('js', 'xml2json.min.js'); My asset (xml2json.min.js) is located under importer/public/assets/js/xml2json.min.js.
I need someone to explain me where to put that asset so Mean.io locates that file.
Thanks.
It turns out it was aggregating assets well. As Mean.io docs say
All assets such as images, javascript libraries and css stylesheets should be within public/assets/{img|js|css}/ of the package file structure.
By default all javascript is automatically wrapped within an anonymous function unless given the option {global:true} to not enclose the javascript within a contained scope.
It's then when you are able to use the external JS functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With