Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Compilation broken in subdirectories (coffee, jst, handlebars, ...) #78

Open
adammunoz opened this issue Jun 25, 2013 · 8 comments
Open

Comments

@adammunoz
Copy link

Hi there,

I noticed quite an annoying misconfiguration in Gruntfile.js.

At least in the following tasks:

  • jst
  • handlebars
  • coffee
  • sass (although not fully tested)
  • test (although this one is warned on the file top comments as being for performance reasons)

We are only specifying one level in the files configuration: *.hbs, *.coffee where it should be either **/*.hbs or {,*/}*.hbs (the same goes for the other file types, coffee, etc ...)

I think the current behaviour is quite confusing for new users who will for example put their models in scripts/models/ only to find that they are not compiled. They might as well think that the generator is broken without even trying to find why it is not compiling.

Yeoman/webapp generator has it right, I think backbone generator should follow the same philosophy instead of asking users to dig into the gruntfile to see why their files are not being compiled

@adammunoz
Copy link
Author

In fact adding to the above:
**/*.ext is better since {,*/}*.ext only goes one further level down and we are with the same problem if the user has 2 nested subdirectories

@revathskumar
Copy link
Member

Regarding the coffee and sass task this is already fixed in master.

Regarding the templates this is okey for the default behaviour since yeoman creates all the templates in the templates folder not in subdirectories.

@adammunoz
Copy link
Author

@revathskumar , I think some of of us (maybe many of us?) like to organize our templates following a logic folder structure rather than have them all mixed up in the same level. Something like the following is quite common in my workflow: templates/a_component/a_sub_subcomponent/.../the_template.hbs

At least I think it might be worthwhile to warn users about the default behaviour being that templates are going to be compiled only if they are on the first level of the templates directory, and possibly document how to change that in the Gruntfile.js in case they want to have a more complex folder structure to store their templates

@addyosmani
Copy link
Member

When it comes down to patterns for directory organization, I favor us opting for the simplest common-denominator and documenting ways to customize this as there will almost certainly be people that want to change it.

As the first of your earlier points was addressed already, I recommend we do:

At least I think it might be worthwhile to warn users about the default behaviour being that templates are going to be compiled only if they are on the first level of the templates directory, and possibly document how to change that in the Gruntfile.js in case they want to have a more complex folder structure to store their templates

@mihow
Copy link

mihow commented Jul 7, 2013

+1 for adding support for sub directories.

@eddiemonge
Copy link
Member

At least I think it might be worthwhile to warn users about the default behaviour being that templates are going to be compiled only if they are on the first level of the templates directory, and possibly document how to change that in the Gruntfile.js in case they want to have a more complex folder structure to store their templates

They already are warned in the Gruntfile: https://github.com/yeoman/generator-backbone/blob/master/app/templates/Gruntfile.js#L9-L13

But all the path/*.ext should be changed to path/{,*/}*.ext to be consistent in the project and across generators

@sindresorhus
Copy link
Member

@eddiemonge i agree.

@jaseemabid
Copy link
Contributor

+1 to support nested templates (at least one extra level)

Regarding the templates this is okey for the default behaviour since yeoman creates all the templates in the templates folder not in subdirectories.

@revathskumar Even though backbone generator and yo generate files in top level /templates, there might be other nested files. Why leave this out when the probability of it breaking for users is quite high? (just happened to me and got here :/) Like @eddiemonge mentioned, I think we should make it consistent across generators by going with path/{,*/}*.ext

PS: Any performance benchmarks available?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants