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

Include in response only CSS variations that are needed #41

Merged
merged 7 commits into from
May 29, 2018

Conversation

cperryk
Copy link
Contributor

@cperryk cperryk commented May 23, 2018

Ensures CSS variations that do not appear on the requested page do not appear in the response HTML.

.reduce((prev, name) => {
prev.push(
path.join(assetDir, 'js', `${name}.js`),
path.join(assetDir, 'js', `${name}.${slug}.js`),
Copy link
Contributor

Choose a reason for hiding this comment

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

don't think we have site-specific component js?

Copy link

Choose a reason for hiding this comment

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

This looks like it was pulled from the previous version that also got three js files for each component https://github.com/clay/amphora-html/blob/v3.3.0/lib/media.js#L192

I can't necessarily speak to why it was setup that way originally, but I suspect it was included here for compatibility reasons

const siteSlug = site && site.slug;

cssFilePaths = state._components
.reduce((acc, curr) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the var acc referring to?

Copy link

Choose a reason for hiding this comment

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

Pretty sure it's the local var for the accumulation of the reduction, could probably change this to pathsToRetrieve or something if that's more clear

@coveralls
Copy link

coveralls commented May 25, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 04dc6c0 on css-optimize into 0d0ca97 on master.

@jonwinton jonwinton merged commit c756672 into master May 29, 2018
@jonwinton jonwinton deleted the css-optimize branch May 29, 2018 20:18
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.

6 participants