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

Solve sass dependencies import parths #10

Open
renatodeleao opened this issue Feb 21, 2019 · 1 comment
Open

Solve sass dependencies import parths #10

renatodeleao opened this issue Feb 21, 2019 · 1 comment
Labels
bug external-dependency Depends from third party tools that we use to build this framework help wanted

Comments

@renatodeleao
Copy link
Collaborator

renatodeleao commented Feb 21, 2019

Note: this issue is only seen while importing @whitemsith/qnorr-styles/scss/qnorr.scss in some specific contexts. Check this comment for explanation

description

We have two external dependencies mappy-breakpoints and normalize.css and they are both imported at qnorr.scss

// current qnorr.scss

@import "../node_modules/mappy-breakpoints/_mappy-breakpoints";

@import "../node_modules/normalize.css/normalize";

This will of-course fail when our package is imported from other websites, that don't have node_modules path resolving. So the path will be:

node_modules/@whitesmith/qnorr-styles/node_modules/mappy-breakpoints/_mappy-breakpoints

Possible workarounds (there's no solution, at least i couldn't found one)

We can beautify this using custom importers for node-sass and have pretty paths, but then we assume that the parent project need to have that configuration.
Apparently there's no de facto solution of module resolving for sass modules. the tilde ~ is the most default at webpack | parcel but there people that use @ as alias as well so we could never know.

A list of current workarounds:

  • include the package inline (as we did before), by copy and pasting to a vendor folder
  • try eyeglass
  • Add a sass variable to customize the path prefix ("~", "@", "./node_modules) edit: this unfortunatelly is not possible

Sass Issues to track

Related issues and links for study

-webpack-contrib/sass-loader#479

@renatodeleao renatodeleao changed the title Solve sass dependencies issues path resolve on sass import Solve sass dependencies dependencies imports Feb 21, 2019
@renatodeleao renatodeleao changed the title Solve sass dependencies dependencies imports Solve sass dependencies import parths Feb 21, 2019
@renatodeleao renatodeleao added the external-dependency Depends from third party tools that we use to build this framework label Feb 22, 2019
renatodeleao added a commit that referenced this issue Feb 22, 2019
renatodeleao added a commit that referenced this issue Feb 22, 2019
@renatodeleao
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug external-dependency Depends from third party tools that we use to build this framework help wanted
Projects
None yet
Development

No branches or pull requests

1 participant