sass-eyeglass / ember-cli-eyeglass

Use eyeglass and node-sass to compile Sass files in your ember project.
13 stars 14 forks source link

Addon Styles Are Not Built #29

Open nickiaconis opened 7 years ago

nickiaconis commented 7 years ago

addon/styles/<addon_name>.scss doesn't get included in the build. To parallel default ember-cli functionality, which includes addon/styles/<addon_name>.css in the build, it should.

This is probably related to #9.

cc @chriseppstein @stefanpenner

nickiaconis commented 7 years ago

I have a not-entirely-working workaround, using broccoli-eyeglass. Something to the tune of:

/* eslint-env node */
'use strict';
const CompileSass = require('broccoli-eyeglass');
const findRoot = require('find-root');
const path = require('path');

module.exports = {
  name: 'my-addon',

  treeForVendor() {
    const styleTree = new CompileSass(['addon/styles'], {
      cssDir: './',
      includePaths: [
        findRoot(require.resolve('eyeglass-module-1')),
        path.join(findRoot(require.resolve('module-2')), 'dist/css'),
      ],
      sourceFiles: [
        'my-addon.scss',
      ],
      cssFilename: 'my-addon.css',
    });
    return styleTree;
  },

  included() {
    this._super.included.apply(this, arguments);
    const vendorCss = path.join('vendor', 'my-addon.css');
    this.import(vendorCss);
  },
};
rwjblue commented 7 years ago

Can you whip up a demo that I could use to debug this?

nickiaconis commented 7 years ago

@rwjblue Here's something at the very least: https://github.com/nickiaconis/eyeglass-addon-demo

Not exactly sure why addon/styles/<addon_name>.css isn't getting included; I have a MP in which that works. It definitely demonstrates that addon/styles/<addon_name>.scss isn't getting included though.

nickiaconis commented 7 years ago

@rwjblue I did a little digging today. I think it's just the tip of the iceberg, but inApp becomes true here when building the addon's dummy app.