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

Minimum version? #522

Open
hanbyul-here opened this issue Jul 26, 2017 · 5 comments
Open

Minimum version? #522

hanbyul-here opened this issue Jul 26, 2017 · 5 comments

Comments

@hanbyul-here
Copy link
Member

  • I do often find myself needing only forms from the styleguide. I think It would be nice if we can make somewhat minimal version of styleguide for this kind of need.
@souperneon
Copy link
Member

Katie brought up having a separate styleguide for demos as well. Should we discuss this in the frondship meeting this week?

@rfriberg
Copy link
Member

I'm thinking about this (and this related issue)... it's true that each page of our website loads more CSS than it needs. But we also don't want to get in the business of generating a single, large, page-specific CSS file for each different page -- as @hanbyul-here noted, that would not allow for caching and would require the browser to re-download the CSS each time the user moves to a different page.

So, here's a two-step proposal (entirely open for discussion):

  1. Slim down styleguide.scss to just the essentials (colors, typography, grid spacing -- i.e., most of the design elements). The generated output will be the bulk of the CSS for any given page and will be cached as soon as a user visits the site (or any site using the styleguide).
  2. Add page-specific scss files, which may or may not be shared between pages. This is where the UI components would come in. Each page-specific file would import only those components it's actually using. (We could also set up a file for "demos" while we're at it.)

Pros:

  • Reduce the overall amount of CSS on a page
  • The majority of the CSS on a page would be cached across all pages (currently we use website.css, developer.css, documentation.css or styleguide.css depending on the page)

Cons:

  • Would be an additional server request (the page-specific CSS)
  • Some of the CSS would likely be repeated (namely SCSS variables and colors)

Thoughts?
cc/ @hanbyul-here @meghanhade @souperneon @kkowalsky

@kkowalsky
Copy link
Member

I think this makes a lot of sense @rfriberg 😸

@souperneon
Copy link
Member

Sounds great @rfriberg!
I know we don't actively think about/track performance but since you bring it up here, I'd be curious to understand the performance comparison if we decide to implement this approach.

@rfriberg
Copy link
Member

I don't think we've tracked performance in the past, but we def think about it (hence the pro/con list above). :)

In digging into this, this strategy is not a huge kb-saver due to all the bootstrap dependencies. I'm going to think about this a little more. 🤔

HOWEVER, in digging around, I did find that most pages were calling the unminified versions of these stylesheets. I'm assuming that's an artefact or oversight so making PRs to change them now. (Let me know if it's intentional!)

For reference, the unminified styleguide.css is 213 KB while the minified styleguide.min.css is 159 KB.

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

4 participants