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

Vendor-in SassMQ functionality, write tests and remove external dependency #657

Merged
merged 5 commits into from Apr 19, 2018

Conversation

kr8n3r
Copy link

@kr8n3r kr8n3r commented Apr 16, 2018

There are a number of scenarios where assuming the sass-mq dependency lives in the same project breaks that have been outlined in #636.

As Sass does not allow dynamic imports we cannot provide a variable to override path to sass-mq stylesheet.

To fix this and avoid external dependencies of Frontend, we've moved the functionality into the project, wrote tests for its mixins and functions and remove dependency from package.json

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 16, 2018 14:39 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 16, 2018 14:42 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 16, 2018 14:48 Inactive
@kr8n3r kr8n3r changed the title VIP: Vendor sass mq Vendor-in SassMQ functionality, write tests and remove external dependency Apr 16, 2018
@kr8n3r kr8n3r mentioned this pull request Apr 16, 2018
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 16, 2018 14:51 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 16, 2018 15:12 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 07:33 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 08:19 Inactive
@NickColley
Copy link
Contributor

NickColley commented Apr 17, 2018

Not great to vendor but I imagine we won't really need to update this, so seems good to me.

Would be good to include a comment in the file that explains it's vendored, and what version it is based on.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 10:31 Inactive
@kr8n3r
Copy link
Author

kr8n3r commented Apr 17, 2018

added the comment about where its vendored from and version

// the current breakpoint from being included multiple times.
//
// the current breakpoint from being included multiple times.
//
// We can't use the `exports` mixin for this because import directives cannot be
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking but if we vendor this is this hack necessary any more? @36degrees

Copy link
Member

Choose a reason for hiding this comment

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

No, not if we wrap the whole of sass-mq in an exports.

// the current breakpoint from being included multiple times.
//
// the current breakpoint from being included multiple times.
//
// We can't use the `exports` mixin for this because import directives cannot be
Copy link
Member

Choose a reason for hiding this comment

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

No, not if we wrap the whole of sass-mq in an exports.

@@ -11,6 +11,6 @@ $sass-mq-already-included: false !default;
$mq-show-breakpoints: ();
}

@import "./node_modules/sass-mq/mq";
@import "../tools/sass-mq";
Copy link
Member

Choose a reason for hiding this comment

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

It seems unnecessary to split media queries across these two layers… and because sass-mq 'outputs' CSS (even if it is just breakpoints) it would make more sense in here. Would suggest just moving sass-mq in here and using exports to simplify the hack as @NickColley identified.

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 14:41 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 14:48 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 14:50 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-657 April 17, 2018 14:59 Inactive
@kr8n3r
Copy link
Author

kr8n3r commented Apr 17, 2018

updated with comments by @NickColley and @36degrees

Jani Kraner added 5 commits April 18, 2018 09:55
There are a number of scenarios where assuming the sass-mq dependency lives in the same project breaks that have been outlined in #636.

As Sass does not allow dynamic imports we cannot provide a variable to override path to sass-mq stylesheet.

To fix this and avoid external dependencies of Frontend,
we've moved the functionality into the project.
Copy link
Contributor

@NickColley NickColley left a comment

Choose a reason for hiding this comment

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

It's regrettable to vendor but helps @penx out so 👍

@kr8n3r kr8n3r merged commit a70c241 into master Apr 19, 2018
@kr8n3r kr8n3r deleted the vendor-sass-mq branch April 19, 2018 15:10
@kr8n3r kr8n3r mentioned this pull request May 18, 2018
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.

None yet

4 participants