Is it a good idea to use ViewModel in Meteor 1.3 according to the Meteor Guide architecture?

Are there any side effects?
https://viewmodel.org/

Thanks!

Idon’t see, why not (especially if you’re using Blaze). there’s a whole thread here: ViewModel 2 - A new level of simplicity

Yeah, as long Blaze is supported by Meteor (and it’s still the “recommended way”), the current VM should work fine, even with the new structure.

Here’s what I recommend. Model your file structure after your application. Start at the root, add the js, html, and tests files (maybe a css if needed). Create a subfolder for each part the current one uses and again put the js, html, and tests files in there. Rinse and repeat.

Add a common/lib folder (name doesn’t really matter) for parts which are used in multiple places. Don’t add a css file just to add styling for a specific element. Use an inline style instead. There’s no point in adding an id to an element just to reference it in the CSS. btw, with ViewModel you rarely need element ids or class names used to select elements.

/client
  main.html
  main.js
  /imports
    app.css
    app.html
    app.js
    app.tests.js
    /part1
      part1.css
      part1.html
      part1.js
      part1.tests.js
      /subpart
        subpart.css
        subpart.html
        subpart.js
        subpart.tests.js
    /part2
      part2.css
      part2.html
      part2.js
      part2.tests.js
    /common
      /item1
        item1.css
        item1.html
        item1.js
        item1.tests.js
2 Likes