Yanick Rochon
Yanick Rochon

Reputation: 53616

Multiple public directories in Meteor?

In meteor, I can have multiple client, multiple server directories, etc. (ex: /foo/client/ and /bar/client/) I segment my app by behavior, for example /users/* for user management, subs, methods, UI, etc., or /inv/* for inventory management, collections, subs, methods, UI, etc., and all other parts of my app. This allow some code organisation and separate components and methods so the app will scale better in the long term.

This works quite well so far, however I need to add some assets to each segments of the app and, since the /public directory content is copied over /.meteor/.local/build/programs/web.browser/app, I wanted to know if it was possible to have multiple public directories, where all files would be merged into the build target?

Upvotes: 0

Views: 35

Answers (1)

hwillson
hwillson

Reputation: 1399

No it isn't currently possible to have multiple public directories within a single application. This is disallowed by Meteor's Isobuild system. If you want to maintain separate /public directories with related component functionality, then you should look into leveraging Meteor packages. Packages can have their own public assets. The "Building Large Apps: Tips" hackpad talks about how you can leverage a "packages-for-everything" approach with Meteor and achieve the type of component separation (with separate public assets) you're looking for. That being said most of the Meteor community has either moved, or is starting to move, away from a "packages-for-everything" approach. The launch of Meteor 1.3 and ES2015 module support has made this approach mostly unnecessary (with a few exceptions, like maintaining separate public assets).

Upvotes: 2

Related Questions