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

Suggestion: consolidate all CSS files into one file #37

Closed
daattali opened this issue Jan 13, 2020 · 4 comments
Closed

Suggestion: consolidate all CSS files into one file #37

daattali opened this issue Jan 13, 2020 · 4 comments

Comments

@daattali
Copy link
Owner

Right now there's one css file per spinner type, plus a fallback css. There's no technical reason that they can't all be included in one file, and then the browser would be able to cache this one. The downside is that the file will be larger, but it's still tiny and negligible.

@andrewsali
Copy link
Collaborator

What's the advantage compared to caching the individual css files?

@daattali
Copy link
Owner Author

For a browser, loading one file of size X is much more efficient than loading two files of size X/2. If you have two different loader types on one page, instead of loading two files you'll only load one. And if I have one app that uses loader type 1, and later I go to a different app that uses loader type 2, the browser would already have the file cached if they're in the same file. Reducing the number of file requests is a very common technique in web development to make loading time much more efficient, even if the single file is larger. Shiny itself also uses a similar technique, for example in the source code there are individual JS files for each input type, but they all get concatenated together into one file when used in shiny apps. It's also similar to the concept of CSS sprite maps.

@andrewsali
Copy link
Collaborator

I was working under the assumption that most people use 1 (at most 2) different spinner styles in any given project, in which case the separate files are probably more efficient ;)

But I don't want to nitpick, I am also perfectly fine with a single file, it's tiny amount of code anyways.

@daattali
Copy link
Owner Author

daattali commented Jan 15, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants