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

Generate blocking + non-blocking CSS files that can be shared across apps #636

Closed
wants to merge 2 commits into from

Conversation

andygout
Copy link
Contributor

@andygout andygout commented Oct 28, 2019

Addresses #546 (or at least is one approach to fixing one part of it… I feel this PR should probably not close the issue entirely).

Dependent on: #611.

Comment on lines +16 to +17
'shared-blocking-styles': '../../packages/dotcom-ui-layout/shared-blocking-styles.scss',
'shared-non-blocking-styles': '../../packages/dotcom-ui-layout/shared-non-blocking-styles.scss'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this means that apps have to be aware of the implementation details of dotcom-ui-layout, and if we add any more packages with shared blocking/nonblocking styles it's quite cumbersome.

me and @i-like-robots discussed making this more abstract, potentially by having a page-kit-cli plugin, along with a separate package.json field, could emit a separate chunk for a dependency's nonblocking styles (this could also then feed into the manifest & asset loader)

Copy link
Contributor

@i-like-robots i-like-robots Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now I think we should go with require.resolve('@financial-times/dotcom-ui-layout/shared-blocking-styles.scss') etc. to avoid the relative path shenanigans.

As Kara hints, we're probably going to massage this feature a few times yet until we get it right!

@include oHeader($features: ('drawer', 'megamenu', 'sticky'), $include-base-styles: false);

// Megamenu z-indexes etc.
@import "@financial-times/dotcom-ui-header/styles";
Copy link
Member

@apaleslimghost apaleslimghost Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is also including all of o-header, so that output is being duplicated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comes from my original example - sorry!

We'll probably need an async/blocking stylesheet for all Page Kit UI components to make this consistent and work 🤔

@i-like-robots
Copy link
Contributor

Closing this in favour of #665 as we have decided to tackle one thing at a time. We are currently not sure if it there is enough - or any - performance gain generating separate blocking/non-blocking CSS bundles for the shared styles so we will avoid this complexity until it becomes necessary.

@i-like-robots i-like-robots deleted the shared-css branch February 18, 2020 11:33
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

Successfully merging this pull request may close these issues.

3 participants