-
Notifications
You must be signed in to change notification settings - Fork 329
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
Update SassMQ import path #637
Conversation
Does this require any documentation updates, or is this a transparent change for users? Is there anyway we can have a failing test for this? |
@@ -11,6 +11,6 @@ $sass-mq-already-included: false !default; | |||
$mq-show-breakpoints: (); | |||
} | |||
|
|||
@import "./node_modules/sass-mq/mq"; | |||
@import "sass-mq/mq"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the webpack sass-loader way of doing this would be "~sass-mq/mq"
https://github.com/webpack-contrib/sass-loader#imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason not to use the ~
syntax here? I think the current implementation would mean that the parent project would need to manually ensure sass-mq
was on the resolution path for sass files, wheras ~
should always work as long as the parent project used sass loader.
Or are you saying that compatibility with Sass build systems that don't support ~
is more important than manual setup?
Would be good to see how existing Sass libraries distributed via npm that have Sass sub-dependencies handle this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what the support is for that syntax? We can make very few assumptions about the technologies involved our consumer's build pipelines, so unless that syntax is very well supported I would be wary of relying on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem (as described at https://github.com/webpack-contrib/sass-loader#imports) is Sass doesn't have a default syntax for library imports.
The 3 options are:
~
node_modules
or./node_modules
- mixing relative + lib paths (
@import "sass-mq/mq";
)
I think all 3 infer either an assumption or requirement from the parent project.
I'll take a look around and see if I can find examples in other Sass projects dealing with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
related, but not found an answer yet:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~ is webpack specific, node-sass doesnt supoort that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a couple comments on sass/node-sass#1596 and also found and commented on sass/sass#2350
Is it ok to assume the parent project will use node-sass
(given that it's distributed via npm)?
Looks like eyeglass may be the recommended solution if so.
Added an example based on the reproduction @penx gave us. I'm not sure this PR is enough to fix it... Edit: Branch I'm talking about: https://github.com/alphagov/govuk-frontend/tree/fix-sass-mq-import-example-tests/examples/using-yarn-workspaces |
with this option: no change
|
In #615 we made adding If this is the only way to do it that shouldn't be a blocker, but we'll need to make sure we update the documentation appropriately. |
yeah if they choose the option without needing to specify the path definition then it feels wrong in having to ask them to do it regardless for this to resolve.
Radical More radical |
25dd00f
to
c89e18d
Compare
won't fix, closing in favour of #657 |
In certain use cases as outlined in #636 the way we were importing SassMQ wasn't resolving correctly.
This change should fix that.
src/globals/helpers/_media-queries.scss
includePaths: 'node_modules'
added to gulp compilation taskincludePaths: 'node_modules'
added to node-sass configuration in tests