javascript - Meteor multiple files for schema and collections -
using meteor, possible separate collections , schemas multiple files each? each separate schema gets own file , same goes collections. there way set inside of lib directory there schemas directory multiple files each containing single schema or subset of schemas.
specifically want leave of collection information in 1 file, split out schemas each page of site has file dedicated schemas. split out schemas different files , put underscore in front, few seemed work , rest broke pages apart of.
├── collections │ ├── collections.js │ ├── _lists.js │ ├── _in.js │ ├── _issues.js │ ├── _reports.js
sure, make sure schema file comes before collection file, because after create collection, you'll need attach schema. no need use lib folder, think common practice set them in collections
folder. if schema alphabetically before collection, you're (just make sure not use var
or put schema on global object).
that said, collection file 2 lines (create, attach) plus couple methods. might toss schema on top of that. you'll still have file under 100 lines (unless schema huge). subschemas, can have _shared.js
. that's put schemas address
multiple collections (clients
, vendors
) can share it.
Comments
Post a Comment