Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not Rails&amp;Ember guy, but here are my general thoughts about feasibility of using Yeoman:</p> <h2>Not using Yeoman: Feasibility</h2> <p>From my experience in combining Yeoman &amp; Django, I must say that it starts to pay off only in medium-sized or bigger projects.<br> In smaller ones, particularly with tight deadlines and not much attention paid to the code quality &amp; tech. solutions used (like Univ. projects), you'll be probably better off sticking with bare Rails (downloading JS libraries manually and committing them accordingly to the Rails project structure). </p> <p>The reason is simple: It might be really time-consuming to fine tune both full-stack framework (Rails) with frontend-framework (Yeoman).<br> Particularly if Rails is driven by <em>CoC</em> principle.<br> It might seem to work after some setup, but as the project evolves, you will spot further obstacles and you'll have to tamper waaaaaaay more. </p> <h3>Cons &amp; things I consider not worth this time investment:</h3> <ul> <li><p><strong>Livereload</strong><br> I like it very much, I was amazed with it at first, but after some time I see that I don't spend that much time editing HTML&amp;CSS in IDE and watching static page on another screen automatically refresh. In majority of cases I still need to do Alt + tab and trigger some action, perform some click, so whether I add one Ctrl+R hit in-between doesn't do any difference.<br> In some cases you'll be better off playing around with Local Folders Mappings (Chrome Dev Tools) or web proxy (e.g.: Fiddler).<br> There are cases where Livereload does a brilliant job though, such as for instance not needing to perform full reload if you edited only CSS.</p> <p>As for your questions:</p></li> <li>For me if it detects changes in JS it reloads whole page. But maybe it's because I'm using JetBrains IDEs (filesystem cache'ing) and CoffeScript (compilation to JS). </li> <li><p>Yeoman is best suited for <a href="http://en.wikipedia.org/wiki/Single-page_application" rel="nofollow noreferrer">SPA</a>s. Would it be acceptable for you to make it a SPA, not a round trip app ?</p></li> <li><p><strong>Bower - Attempt to provide dependency management for github projects</strong><br> What bower does <strong>for your app</strong> is basically downloading stuff from github. No rocket science here.<br> If the structure of downloaded thing is non-standard, Bower/RequireJS/Grunt-bower-install has no bloody idea what to do with it next, i.e. how to inject everything so that you won't get errors. For most popular libraries bower just works, for highly customized ones you will end up injecting downloaded stuff manually.<br> The ones to blame are people who don't package useful github projects properly.</p> <p>Furthermore I heard of workflows where people commit <code>bower_components</code> due to problems with bower, never experienced personally though, perhaps the issues were fixed. If so possibility of not committing 3rd libraries to source code is definitely an advantage.</p> <p><strong>Note:</strong> As I pointed out above, it's how bower helps you developing <strong>your app</strong>, but bower has become somewhat a standard in the frontend community, for instance <a href="http://ngmodules.org/" rel="nofollow noreferrer">http://ngmodules.org/</a> is build on top of that, so it's a important tool.</p> <p>Can Rails assembly pipeline fetch arbitrary github project ? Yes.<br> Can it inject library references to your html ? Duno, I'm not Rails guy.</p></li> <li><p><strong>Generators</strong><br> Some could do a beautiful job, such as configuring whole heroku-related stuff for you. Too bad <code>generator-heroku</code> doesn't work as expected (tried it sth like 2 months ago). Same was true for <a href="https://stackoverflow.com/questions/19255976/how-to-make-travis-execute-angular-tests-on-chrome-please-set-env-variable-chr">travis generator</a>. In this case fix was easy, but see the next point.<br> As for Angular generators (I'm Angular guy, not Ember guy, sorry :-) ) - it just adds 2 files and includes them in <code>index.html</code>, furthermore if you are using not so straight-forward syntax for creating JS framework related stuff (sample: <a href="http://alxhill.com/blog/articles/angular-coffeescript/" rel="nofollow noreferrer">Angular-related stuff in coffee</a>) generator will most probably not know about it. Ok, you can submit a patch to generator, but then AngularJS team decides to change the syntax a little bit in the next release - you get the idea ? - again, see the next point.<br> What is more, if your project uses layout in which code is structured by <em>feature/module</em> (e.g. admin module, profile settings module, ...), not by <em>type</em> (directives, controllers, ...) framework-specific generators won't work.</p></li> <li><p><strong>Stability</strong><br> Karma is evolving rapidly, so does Angular, Angular-UI and loads of fronted tools, frameworks.<br> It's really difficult for Yeoman to keep up with most recent changes, although they do a nice job here. </p></li> </ul> <h2>Employing Yeoman: Being <em>cutting-edge</em></h2> <p>Yeoman provides some really cool stuff such as:</p> <ul> <li><p><strong>Linting</strong></p></li> <li><p><strong>Compiling coffeescript, SASS/SCSS, etc. on the fly</strong></p></li> <li><p><strong>CDNifying</strong><br> Really useful when you want to have libraries downloaded locally in case of developing offline and still benefit from pros of CDN.<br> Without Grunt you would have ended up writing scripts parsing your HTMLs</p></li> <li><p><strong>Automated JS/CSS minification</strong><br> Grunt does it for you. You only have to configure it properly.</p></li> <li><p><strong>Encouraging separation and low coupling of your frontend and backend</strong><br> As for your question: I doubt that you'll be able to manage Rails part solely with Yeoman.<br> A good recipe for a web app in Yeoman &amp; sth is: <a href="https://stackoverflow.com/a/19425461/1432478">https://stackoverflow.com/a/19425461/1432478</a>.<br> That's for Django, adapt it accordingly to Rails.</p></li> </ul> <h2>My opinion</h2> <p>In majority of small projects based purely on Spring MVC, Rails, Django, etc. you simply don't perform any of things done by Grunt (hence there's less time expenditure for setup).<br> There are cases when producing technologically advanced frontend is a must.<br> e.g.: Most recently I discovered that my bank account management system doesn't minify JSes. Even funny comments are left as they were. I didn't perform any rushed money withdrawal, but I hope they at least have server-side validation. :-) </p> <p>Yeoman is a really good combination of solutions facilitating all those chores. </p> <p>Using only Grunt? IMHO No. Yeoman is Grunt when it comes to app assembly. You get Livereload and other stuff for free.</p> <p>If: </p> <ol> <li>you're lucky and found sample config that seems to work for the web framework of your choice or managed to configure one on your own</li> <li>don't have deadlines to hold</li> </ol> <p>then you should probably give it a try. </p> <p>If you will work on multiple projects, chore of configuring it once might pay off by copy-pasting config to future projects. But keep in mind that frontend technologies are rapidly evolving, that's why tons of samples from the net simply don't work out of the box. </p> <h3>Further reading :)</h3> <ul> <li><a href="http://blog.tfnico.com/2013/07/considerations-for-javascript-in-modern.html" rel="nofollow noreferrer">http://blog.tfnico.com/2013/07/considerations-for-javascript-in-modern.html</a></li> </ul> <p>Java world here, but I hope some concepts will be useful:</p> <ul> <li><a href="http://addyosmani.com/blog/making-maven-grunt/" rel="nofollow noreferrer">http://addyosmani.com/blog/making-maven-grunt/</a></li> <li><a href="https://stackoverflow.com/questions/15406977/javascript-web-app-and-java-server-build-all-in-maven-or-use-grunt-for-web-app">Javascript web app and Java server, build all in Maven or use Grunt for web app?</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload