Skip to content
This repository has been archived by the owner on Feb 17, 2019. It is now read-only.

Eyeglass in Ember addons and engines #9

Closed
Kaceykaso opened this issue May 12, 2016 · 3 comments
Closed

Eyeglass in Ember addons and engines #9

Kaceykaso opened this issue May 12, 2016 · 3 comments

Comments

@Kaceykaso
Copy link

Kaceykaso commented May 12, 2016

When including ember-cli-eyeglass for sass compiling within an addon or engine, Eyeglass only looks inside the app directory, not the addon directory (app should be empty), and complains. Root issue is really with eyeglass not able to compile an addon, since it only looks in node_modules/ember-cli-eyeglass/index.js, looks for consuming app's env, and then dies:

Example error output:

⠋ BuildingCannot read property 'env' of undefined
TypeError: Cannot read property 'env' of undefined
    at Object.registry.add.toTree (/Users/cklimkow/workspace/testmanager-engine_trunk/node_modules/ember-cli-eyeglass/index.js:34:59)

Current hack/work-around:

//package.json
"eyeglass": {
    "exports": "eyeglass-exports.js",
    "name": "addon-name",
    "needs": "^0.8.2"
  },
  "keywords": [
    "ember-addon",
    "eyeglass-module"
  ]

...and then we create an eyeglass-exports.js file in the root:

//eyeglass-exports.js
/* jshint node:true */
var path = require('path');

module.exports = function(/* eyeglass, sass */) {
  return {
    sassDir: path.join(__dirname, 'addon', 'styles')
  };
};

Consuming Ember app must then @import "addon-name"; in its app.scss.

/cc @cklimkowsky @nathanhammond

@caseklim
Copy link

The culprit is line 34 in index.js: var projectConfig = addon.project.config(addon.app.env);

app is undefined, since ember-cli-eyeglass is being used in an addon rather than an app. I'm assuming this should instead be a recursive call to find the app that is consuming the addon using ember-cli-eyeglass.

@whastings
Copy link
Contributor

@Kaceykaso @cklimkowsky I believe PR #12 (released in version 0.5.0) fixes this issue. Can you please confirm and close this issue if so?)

@chriseppstein
Copy link
Contributor

This is fixed.

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

4 participants