Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import gallery components styles individually #144

Closed
magoss opened this issue Jul 27, 2018 · 8 comments
Closed

Import gallery components styles individually #144

magoss opened this issue Jul 27, 2018 · 8 comments
Milestone

Comments

@magoss
Copy link

magoss commented Jul 27, 2018

I've got a problem with implementing basic example. I followed code example shown on your page regarding Gallery:
https://murhafsousli.github.io/ngx-gallery/#/gallery

What is the expected behavior?

I'd like to display gallery in any way.

What is the current behavior?

Following code example from documentation seems to not work. Isn't documentation out-of-date, is it?

What are the steps to reproduce?

Check stackblitz out here:
https://stackblitz.com/edit/angular-cu7ygs?file=src/app/app.component.ts

Which versions are you using for the following packages?

Angular: 6.1.0
Angular CDK: 6.4.1
Angular CLI: 6
Typescript:
Gallery: 3.0.2

@MurhafSousli
Copy link
Owner

MurhafSousli commented Jul 27, 2018

@magoss No, the docs are up to date. Where is the issue? the gallery is working in your stackblitz!

@magoss
Copy link
Author

magoss commented Jul 27, 2018

I tracked the problem. It was the matter of place of import styles. I wanted to do it in component styles, but it works only in global file. It's mentioned in docs, you are right, but in my opinion it's a little bit optimization problem, because you have to import whole styles of gallery no matter user decide to load appropriate component.

@MurhafSousli
Copy link
Owner

MurhafSousli commented Jul 27, 2018

@magoss The styles aren't huge, their size combined are less than 4.5kb
But if you are too concerned about the extra styles. you can create SCCS file and copy the styles that you use only but that won't save you more than 2kb at most

@MurhafSousli MurhafSousli changed the title Basic example seems to not work Import gallery components styles individually Jul 27, 2018
@magoss
Copy link
Author

magoss commented Jul 30, 2018

@MurhafSousli My use case is more like media attachments viewer. I use ngx-gallery to make it possible to review files attached to sort of reports. I'm not using this module like a carousel or slider at the home page. That's why I ment I wouldn't like to load styles in style.scss (global file). Instead, I want to load it only when user gets into reports (one of many pages). In Stickblitz example I'd like to load it in app.component.scss.

Look at the repro once again, I edited it the way the import in styles.scss is commented out, but I placed similar one at the component level. It doesn't work that way. That is the clue. Because in my real world app I have to import it on global level regardless user needs it or not at all. Is there any workaround currently?

@MurhafSousli
Copy link
Owner

No, currently it has to be loaded globally, did you try copy&paste gallery styles into your lazy component styles instead?

@magoss
Copy link
Author

magoss commented Jul 30, 2018

Nope. I'm not prefer that way, because I'd like to be compliant with your library new versions. Failure to comply may cause problems with i.e. Angular upgrade.

@MurhafSousli
Copy link
Owner

@magoss So what do you suggest? do you have a solution?

@magoss
Copy link
Author

magoss commented Jul 31, 2018

I mean I'm afraid of copying code manually, because your library breaking changes could prevent me from smooth upgrade of ngx-gallery. If adapting breaking changes of your library would be required to be compliant with i.e the next version of Angular (which I encountered while working with other library) - it could potentially cause serious troubles for us.

@MurhafSousli MurhafSousli added this to the 3.1.0 milestone Aug 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants