Semantic-UI-Ember icon indicating copy to clipboard operation
Semantic-UI-Ember copied to clipboard

Allow configuration of imported modules

Open seawatts opened this issue 8 years ago • 6 comments

It would be nice to be able to only include css and js files of "components" that you are going to use instead of just importing semantic.css and semantic.js

e.x.

var app = new EmberApp(defaults, {
  // Add options here
  SemanticUI: {
    import: {
      components: ['shape', 'nag', 'modal', 'menu'],
    }
  }
});

If the components array is present then don't include semantic.css and semantic.js and only pick the .css and .js files for the components specified.

seawatts avatar Dec 09 '16 02:12 seawatts

Thanks for the suggestion. I've thought of doing that, but since we just import the semantic base files at the moment, that would take a bit more work to build out a custom semantic ui build and only import specific modules.

The actual semantic ui ember library is 90% contained in the base mixin, so there wouldn't be a ton of savings for excluding components unless you didn't want them imported.

aaronbhansen avatar Jan 06 '17 00:01 aaronbhansen

@aaronbhansen A good starting point would be to selectively import the SUI files from bower (which I believe @seawatts is talking about here). I've done this type of thing for other addons and could probably put something together if you'd like. The piece I'm not sure about is how to selectively import the addon components, but know of some other addons doing this that I could refer to.

Panman82 avatar Jan 06 '17 13:01 Panman82

@Panman8201 I haven't looked at pulling out pieces from bower selectively. If you have an idea on how to do that would be great.

For selectively importing components, I know ember-composable-helpers has that option. It would be fairly easy to add, but there isn't much difference in file size as the base mixin is 95% of the plugin. So it would be purely for ensuring that you didn't have access to components if you didn't want them.

aaronbhansen avatar Jan 06 '17 15:01 aaronbhansen

@aaronbhansen Sure, I've dealt with selective bower imports for ember-froala-editor and ember-cli-bootswatch.

Panman82 avatar Jan 06 '17 17:01 Panman82

@aaronbhansen yes @Panman8201 is correct. It basically would only import the specific js and css files for the respective components in semantic ui bower folder. image

seawatts avatar Jan 09 '17 19:01 seawatts

Not fully understanding how to get around this issue. I'm only using about half of the modules in SUI and would love to use Ember SUI, but how would I "turn off" output into vendor files to somehow include only what I want to use? Thanks in advance.

archebyte avatar Jun 26 '18 20:06 archebyte