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

Why does rewriteImports not support paths outside __dirname(file)? #101

Open
tombh opened this issue Aug 28, 2019 · 2 comments
Open

Why does rewriteImports not support paths outside __dirname(file)? #101

tombh opened this issue Aug 28, 2019 · 2 comments
Labels

Comments

@tombh
Copy link

tombh commented Aug 28, 2019

I'm using Google's Material Design framework and decided to try to use sass-resources-loader because I hear that importing mixins directly in my SCSS files degrades build times (is this true?). However, it seems that all of the mixins in the framework import other shared mixins and variables from elsewhere in the framework's tree. For example:

@import "@material/feature-targeting/functions";
@import "@material/feature-targeting/mixins";

@mixin mdc-tab-bar-core-styles($query: mdc-feature-all()) {
  // postcss-bem-linter: define tab-bar
  .mdc-tab-bar {
    @include mdc-tab-bar-width(100%, $query);
  }
  // postcss-bem-linter: end
}
// snip ...

Such paths are imported by sass-resources-loader as: ../../node_modules/@material/tab-bar/@material/feature-targeting/mixins. Notice how the path to import is appended to the file's base path. I'm surprised that nobody else has had this problem. Maybe I'm doing something wrong? Or maybe Google's Material Design framework is the only framework that shares mixins like this?

I suppose the only fix is to support an OS-style $PATH array? Or to check if the path it import starts with ./?

Here is the current rewrite code in this repo for reference:
https://github.com/shakacode/sass-resources-loader/blob/master/src/utils/rewriteImports.js#L26

@justin808
Copy link
Member

@tombh any update?

@tombh
Copy link
Author

tombh commented Jan 7, 2020

I stopped using this project :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants