iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 412 forks source link

'Organize your Meteor application' after add import folder #1543

Open stephane-r opened 8 years ago

stephane-r commented 8 years ago

Hi every body,

I would like add import folder in my Meteor APP.

But, after import my routes and layout, i've Organize your Meteor application rendered.

My imports/statup/client/routes.js :

` import { IronRouter } from 'meteor/iron:router';

import '../../../ui/layout/layout.js';

// Configuration
Router.configure({
    loadingTemplate: 'loading',
    notFoundTemplate: 'notFound',
    layoutTemplate: 'layout',
    waitOn: function () {
        return [
            Meteor.subscribe('posts'),
            Meteor.subscribe('skills'),
            Meteor.subscribe('tasks'),
            Meteor.subscribe('profil'),
            Meteor.subscribe('messages')
        ];
    },
    onAfterAction: function () {

        profil = Profil.findOne({},{
            sort: {
                createdAt: 1
            }, limit: 1
        });

    }
});

// Home page
Router.route('/', {
    name: 'home',
    itemName: 'Yeah'
});`

And my imports/ui/layout/layout.js :

` import './layout.html';

import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';`

Do you have any idea why Iron Router have error ?

Thank you !

Batistleman commented 8 years ago

Are you calling the /imports/statup/client/routes.js from your main client file?

Like: /client/main.js:

import 'imports/statup/client/routes.js';

PS. I would advice you to use absolute paths in your files, instead of import '../../../ui/layout/layout.js';, it will save you a lot of pain if you do some refactoring ;-)

ayoung4 commented 8 years ago

what error is Iron Router coming up with?

One thing I see is that import { IronRouter } from 'meteor/iron:router'

should be import { Router } from 'meteor/iron:router'

also I dont see itemName listed in the section on route specific options in the documentation: http://iron-meteor.github.io/iron-router/