angular / material-tools

Tools for AngularJS Material

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Theme - core-theme is not included in output

RasmusTG opened this issue · comments

In the theme generation, in the core-theme (s)css module, it is not including the styles for html and body

html, body {
  &.md-THEME_NAME-theme {
    color: '{{foreground-1}}';
    background-color: '{{background-color}}';
  }
}

I see in LocalResolver.ts resolve method:

let sourceComponents = path.join(sourceRoot, 'components');
this.resolveThemes(modules, sourceComponents),

which does not include the file:
/src/core/styles/core-theme.scss

I see two solutions

1)
Change the path to be

In LocalResolver.ts
this.resolveThemes(modules, jsModules),

And in LocalReolver.spec.ts to match the css file

  it('should have the themes separately', done => {
    LocalResolver.resolve(tooltip, versionData).then(files => {
      reduceToFilenames(files);

      expect(files.themes).toContain('tooltip-default-theme.css');

      done();
    }, done.fail);
  });

Then themes are generated based on the css files.

2)
Add the path to the core-theme.scss,


let sourceCore = path.join(sourceRoot, 'core');

this.resolveThemes(modules, sourceComponents),
this.resolveThemes(modules, sourceCore),

return Promise.all([
      this.resolveExtension(modules, 'js', jsModules),
      this.resolveExtension(modules, 'css', jsModules, false),
      this.resolveThemes(modules, sourceComponents),
      this.resolveThemes(modules, sourceCore),
      this.resolvePattern('/*.+(layouts|layout-attributes).css', layoutModules, false),
      this.resolveSCSS(modules, sourceRoot),
      this.resolvePattern('/LICENSE', _package.module, false)
    ])
    .then(results => {
      return {
        root: _package.root,
        js: results[0],
        css: results[1],
        themes: results[2].concat(results[3]),
        layout: results[4],
        scss: results[5],
        license: results[6][0]
      };
    });

Which solution would you prefer ?

Thanks for the issue. I would just include the core-theme.scss in the resolveThemes method in the resolver.