aurelia-ui-toolkits / aurelia-materialize-bridge

Materialize CSS components for Aurelia
http://aurelia-ui-toolkits.github.io/demo-materialize/
MIT License
155 stars 53 forks source link

separate modules #543

Closed istrau2 closed 5 years ago

istrau2 commented 5 years ago

Has there been any thought to publishing this library in separate modules (for each component) so that we can choose to only include those modules (and their dependencies) in our project? This has size and security implications.

Currently, when I only specify useCheckbox(), all modules are included in the bundled app (because there are still module dependencies in the code).

Thanks.

MaximBalaganskiy commented 5 years ago

The Materialize framework itself is not modular. Plus, most of the bridge's size comes from the md-colors element which has inline styles to support themes. So unless you cut md-colors from your site there'll be not much benefit.

istrau2 commented 5 years ago

@MaximBalaganskiy How can we cut md-colors out of our site (we don't use it)?

Also, there may not be size implications but there certainly are security implications. For example, I am seeing some datepicker and clock dependencies in our bundle that I am assuming come as deps of this library.

MaximBalaganskiy commented 5 years ago

At the moment, it's a bit complex - you can cut out all aurelia-materialize-bridge imports in order to NOT import its' index file and then push individual elements to global resources. You will have to copy and paste some imports from that index file as well

import { Dummy } from "./augmentation/aurelia-typed-observable";
import "./polyfills/append";
import "./polyfills/remove";
import "./polyfills/pad-start";

I'm not sure what security implications you refer to though, There are md-datepicker and md-timepicker custom elements and that's it. Even the materialize framework is just a peer dependency. As I mentioned previously, M is a monolithic package and you always get its' datepicker and timepicker functions.