Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redundant file naming #12

Open
Nemo64 opened this issue Apr 17, 2014 · 11 comments
Open

redundant file naming #12

Nemo64 opened this issue Apr 17, 2014 · 11 comments
Labels

Comments

@Nemo64
Copy link

Nemo64 commented Apr 17, 2014

This is more a question! If I create the scaffold for person i'll have this folder structure:

client/controllers/person
client/controllers/person/person_index.js
client/views/person
client/views/person/person_index
client/views/person/person_index/person_index.html
client/views/person/person_index/person_index.js
client/views/person/person_index/person_index.css

Isn't that person_index kind of redundant if it is in a folder called person? I know that the template must be called PersonIndex because of missing namespaces, but the folder and file names seem wrong to me. Am I missing something?

@cmather cmather added the idea label Apr 19, 2014
@cmather cmather added this to the Ideas and Design milestone Apr 19, 2014
@cmather
Copy link
Contributor

cmather commented Apr 19, 2014

The idea is that a "person" could have multiple views including a list view, details view, etc. So instead of having a bunch of top level folders you could put them under the /person folder. We could probably improve the scheme by discussion and people putting up their ideas.

@Nemo64
Copy link
Author

Nemo64 commented Apr 19, 2014

I'm coming from a symfony background and there i'm used to that the views are only index.html.twig, show.html.twig, edit.html.twig and so on inside a folder which is named after the controller.

client/controllers/person/index.js
client/controllers/person/show.js
client/views/person
client/views/person/index
client/views/person/index/index.html
client/views/person/index/index.js
client/views/person/index/index.css
client/views/person/show
client/views/person/show/show.html
client/views/person/show/show.js
client/views/person/show/show.css

I don't think that would be as bad.... but it could be a lack of meteor experience there. it's just the first thing i noticed while trying em out. ;)

@cmather
Copy link
Contributor

cmather commented Apr 19, 2014

Oh I missed your point entirely. You're saying to remove the person_ prefix. That seems like a reasonable improvement :). Interested in others' feedback too.

@Spiralis
Copy link

@cmather I second that. Of course, the templates need to be named using the folder and the view-name, like @Nemo64 suggests.

@zimt28
Copy link

zimt28 commented Apr 21, 2014

I like @Nemo64's suggestion, that's the structure I'm used to :)

@scottmcpherson
Copy link
Contributor

This might be another option that would be great to have in the .em/config.json file(devel branch). Maybe something like this?:

{
  "view": {
    "html": {
      "create": true,
      "extension": ".jade"
    },
    ...
    "scaffold: {
        "folderStructure": "client/views/[resource]/[resource]_index/[resource]_index.*"
    }
  }
}

@ghost
Copy link

ghost commented Nov 18, 2014

When developing, I frequently have 20-30 tabs open in WebStorm. Given that Meteor projects favour lots of small files (a Good Thing™) with this naming convention I'd end up with potentially a dozen or so file tabs all called "index.html".

So far, we've settled on "explicit" filenames, for example personList.html or .js, personCreate.html or .js, personCollection.js, personPublication.js etc. which makes it easier quickly to identify a file tab. Filename completion usually takes care of the typing when opening a file, so doesn't cause extra work.

I'd welcome your thoughts on this, maybe we're doing it the "stupid way" and there's an easier way to keep all these files sorted out visually? :)

@Nemo64
Copy link
Author

Nemo64 commented Nov 18, 2014

Good point. I use jetbrains ide's which show tabs like this:
screenshot 2014-11-18 12 03 53
So I usually don't have that problem but others may.

I'm actually against making everything configurable as I want to be able to quickly use another project but if everyone uses other convention, it'll become somewhat annoying imo.

@Spiralis
Copy link

I use sublime which also shows extra context in the tabs when needed. So, for me too the change is welcome. I personally don't mind having the configuration option though. I'd rather do the extra config option and have a less "bloated" structure. It helps me keeping the projects and the code "clean" 😄.

@rhyslbw
Copy link

rhyslbw commented Dec 15, 2014

@DigitalAndre there's a configuration option in WebStorm 'Show directory in editor tabs for non-unique filenames' that solves the ambiguous display.

+1 for simplifying the filenames. I've actually stopped using the tool since the redundant folder names were making the tree structures hard to read and understand the app

@ianserlin
Copy link

We do it the same as @DigitalAndre and I prefer it that way, even though I have a full paths in my sublime title bar. In sublime the CMD+t search works across directory names so it's not a huge issue however.

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

No branches or pull requests

7 participants