Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

--include-path not working anymore in 4.4.0 #1876

Closed
olivierbossel opened this issue Jan 30, 2017 · 16 comments
Closed

--include-path not working anymore in 4.4.0 #1876

olivierbossel opened this issue Jan 30, 2017 · 16 comments

Comments

@olivierbossel
Copy link

  • NPM version (npm -v): 3.10.10
  • Node version (node -v): 6.9.4
  • Node Process (node -p process.versions):
{ http_parser: '2.7.0',
  node: '6.9.4',
  v8: '5.1.281.89',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '57.1',
  modules: '48',
  openssl: '1.0.2j' }
  • Node Platform (node -p process.platform): darwin

  • Node architecture (node -p process.arch): x64

  • node-sass version (node -p "require('node-sass').info"):

  • node-sass 4.4.0 (Wrapper) [JavaScript]

  • libsass 3.5.0.beta.2 (Sass Compiler) [C/C++]

  • npm node-sass versions (npm ls node-sass): 4.4.0

Hi there,

Just to point out that the --include-path seems to not work anymore from this version. It was working in the node-sass 4.3.0 but not in the 4.4.0...
When I import some node_modules sass like:

@import "node_modules/modularscale-sass/stylesheets/modular-scale";

it is yielding that the file is not readable. It works if I force the 4.3.0 version...

Hope this is not something to big to fix...
Let me know :)

Cheers guys, thanks for your work it's quite awesome!

Best regards

Olivier Bossel

@kaelig
Copy link

kaelig commented Jan 30, 2017

I have an issue probably related to this as well. I'm using gulp-sass though.

I have to specifically write @import '../../node_modules/my-module/index'; instead of node_modules/my-module/index which used to work.

@nschonni
Copy link
Contributor

@olivierbossel can you provide a minimal project that reproduces this along with with the actual command line and log

@nschonni
Copy link
Contributor

@kaelig ... isn't a valid path navigator. Try switching it to ..

@kaelig
Copy link

kaelig commented Jan 30, 2017

@nschonni I updated my comment.

Here's a project you can test my issue in: https://github.com/salesforce-ux/design-system-starter-kit

Steps to reproduce:

  1. git clone https://github.com/salesforce-ux/design-system-starter-kit.git
  2. git checkout b3293e8b2f1f1bd9a1bb0c2174885cb4c4d99b81
  3. npm install
  4. npm run dev

This error pops up:

Error in plugin 'sass'
Message:
    src/styles/index.scss
Error: File to import not found or unreadable: node_modules/@salesforce-ux/design-system/scss/index.
       Parent style sheet: /Users/kdeloumeauprigent/workspace/salesforce/design-system-starter-kit/src/styles/index.scss
        on line 9 of src/styles/index.scss
>> @import 'node_modules/@salesforce-ux/design-system/scss/index';
   ^

@nschonni
Copy link
Contributor

nschonni commented Jan 30, 2017

@kaelig you're not providing any value for includePath in your Gulp config. node_modules isn't automatically added to include paths anymore (or hasn't been for awhile AFIAK).

@kaelig
Copy link

kaelig commented Jan 30, 2017

I thought the current directory was supposed to be in the includePaths by default (in that case: the root of the project from which the script is called)?

@nschonni
Copy link
Contributor

I thought the current directory was supposed to be in the includePaths by default

No, https://github.com/sass/node-sass#includepaths. That causes problems because then it starts to try and pick up random packages (accidentally) published components.

@kaelig
Copy link

kaelig commented Jan 30, 2017

@nschonni node-sass src/styles/index.scss works like a charm though. Is there something I'm missing here? Could it be related to gulp-sass directly?

@xzyfer
Copy link
Contributor

xzyfer commented Jan 30, 2017

Sorry the delayed response, Australian timezone and such. This is a bug. There was an unnecessary breaking change in LibSass regarding load paths. I missed this in the release notes for LibSass and forgot to compensate for it in node-sass.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 30, 2017

I thought the current directory was supposed to be in the includePaths by default

This is kind of true.

@nschonni is correct in that node-sass isn't doing this.

LibSass was internally adding the cwd of the entry file to it's internal search path, which is similar to user defined load paths. This was removed in LibSass 3.5.0 release line. Node Sass needs to be updated to shim the old behaviour for the time being.

Could it be related to gulp-sass directly

@kaelig gulp-sass does add the cwd to the load path.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 30, 2017

It's not clear to me why you're experiencing the issue with gulp-sass and not node-sass. I would expect the inverse to be true. I'll have to investigate tonight.

@azizur
Copy link

azizur commented Jan 31, 2017

I am seeing this same issue as well. At first, I thought it as my gulp project where I am making lots of change so frequently.

@xzyfer
Copy link
Contributor

xzyfer commented Jan 31, 2017

A work around for now is adding the cwd to your includePaths.

@azizur
Copy link

azizur commented Jan 31, 2017

You mean set SASS_PATH=. in your shell's environment.?

@xzyfer
Copy link
Contributor

xzyfer commented Jan 31, 2017

No, I mean in the includePaths array in the render/renderSync config object, or the gulp-sass config object.

gulp.src('./scss/*.scss')
  .sass({ includePaths: ['./scss'])
  .dest('./dest')

@olivierbossel
Copy link
Author

Hi there,

Sorry for the delay (Switzerland timezone...).
Thanks for the quick response guys, seems that it's not an isolated issue.
Did you need some help or that I post a demo project that has the issue?

Let me know! :)

xzyfer added a commit to xzyfer/node-sass that referenced this issue Jan 31, 2017
Traditionally Sass has added the cwd as the first include path. This
behaviour was remove in Sass 3.4, and recently in LibSass 3.5.0.beta.2.
People depend on this behaviour and as a result a lot of compilations
are now failing.

This PR restores the expected behaviour and adds a test to boot.

Fixes sass#1876
xzyfer added a commit to xzyfer/node-sass that referenced this issue Jan 31, 2017
Traditionally Sass has added the cwd as the first include path. This
behaviour was remove in Sass 3.4, and recently in LibSass 3.5.0.beta.2.
People depend on this behaviour and as a result a lot of compilations
are now failing.

This PR restores the expected behaviour and adds a test to boot.

Fixes sass#1876
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants