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

Component Styles not loaded #509

Closed
ChrisSG opened this issue Jun 8, 2015 · 1 comment
Closed

Component Styles not loaded #509

ChrisSG opened this issue Jun 8, 2015 · 1 comment

Comments

@ChrisSG
Copy link

ChrisSG commented Jun 8, 2015

Seems like the styles of components are nvere loaded. Did not find any code in components.js that would load styles. Only loads the views...

App.prototype.component = function(viewName, constructor) {
  if (typeof viewName === 'function') {
    constructor = viewName;
    viewName = null;
  }

  // Inherit from Component
  extendComponent(constructor);

  // Load template view from filename
  if (constructor.prototype.view) {
    var viewFilename = constructor.prototype.view;
    viewName = constructor.prototype.name || path.basename(viewFilename, '.html');
    this.loadViews(viewFilename, viewName);

  } else if (!viewName) {
    if (constructor.prototype.name) {
      viewName = constructor.prototype.name;
      var view = this.views.register(viewName);
      view.template = templates.emptyTemplate;
    } else {
      throw new Error('No view name specified for component');
    }
  }

Adding this here seems to do the job...

  if (constructor.prototype.style) {
    styleFilename = constructor.prototype.style
    this.loadStyles(styleFilename)
  }

then continue with components.js

  // Associate the appropriate view with the component type
  var view = this.views.find(viewName);
  if (!view) {
    var message = this.views.findErrorMessage(viewName);
    throw new Error(message);
  }
  view.componentFactory = createFactory(constructor);

  // Make chainable
  return this;
};
@ChrisSG
Copy link
Author

ChrisSG commented Jun 8, 2015

Closed as to PR #505 ...

@ChrisSG ChrisSG closed this as completed Jun 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant