How to aggregate JS assets on Mean.io

I am new to Mean.io and I am trying to compile an external .js file into my package, but I am doing it wrong because it is not added to aggregated.js.

This is what I did:

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; }); 

Important line: importer.aggregateAsset ('js', 'xml2json.min.js'); My asset (xml2json.min.js) is under the importer / public / assets / js / xml 2json.min.js .

I need someone to tell me where to place this asset, so Mean.io finds this file.

Thanks.

+5
source share
1 answer

It turns out that he aggregated assets well. How Mean.io docs say

All resources, such as images, javascript libraries, and CSS styles, must be within public / assets / {img | js | css} / package file structure.

By default, all javascript is automatically wrapped in an anonymous function if {global: true} is not set so as not to embed javascript within the contained area.

Then, when you can use the external functionality of JS.

+3
source

Source: https://habr.com/ru/post/1208159/


All Articles