Code inside package.js


#1

is it possible to load package assets based on logic other than client,server? My package provides different css for desktop and mobile. If I api.addFiles them both the files would be added to the application. If I don’t addFiles them, I can’t access the files in the package.

How is it possible to provide assets that are not automatically added to the application?


#2

if you only want to export the file on the server (or the client), you can pass in the second argument (e.g., ‘server’, ‘client’, ‘web.browser’, ‘web.cordova’) to specify what architecture the file is used with.
http://docs.meteor.com/#/full/pack_addFiles

web.cordova for your mobile css
web.browser for your browser css


#3

Thank you, that was easy …

<hanging head in shame>


#4

For more complex scenarios where the dynamics are more than the choice between cordova/browser, you could use the isAsset flag, and load each file asynchronously depending on your rules.


#5

Hey I was searchining info about this, and I saw your answer.
How can I load assets asynchronously from the package.js?
Thanks!


#6

you cannot do that from package.js. I was refering to loading from within the client since the files you mark as isAsset end up outside the bundle but available to the application (like the public folder)