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

node-sass watch does not find @include myMixin() #2762

Closed
wende60 opened this issue Oct 22, 2019 · 2 comments
Closed

node-sass watch does not find @include myMixin() #2762

wende60 opened this issue Oct 22, 2019 · 2 comments

Comments

@wende60
Copy link

wende60 commented Oct 22, 2019

  • NPM version (npm -v): 6.4.1
  • Node version (node -v): 10.15
  • Node Process (node -p process.versions): {
    http_parser: '2.8.0',
    node: '10.15.0',
    v8: '6.8.275.32-node.45',
    uv: '1.23.2',
    zlib: '1.2.11',
    ares: '1.15.0',
    modules: '64',
    nghttp2: '1.34.0',
    napi: '3',
    openssl: '1.1.0j',
    icu: '62.1',
    unicode: '11.0',
    cldr: '33.1',
    tz: '2018e'
    }
  • 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.12.0 (Wrapper) [JavaScript]
    libsass 3.5.4 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass): node-sass@4.12.0

main.scss contains:

  @import './scss/mixins.scss';
  @import './scss/home.scss';

mixins.scss contains:

  @mixin biggerMobile() {
      @media (min-width: 650px) {
          @content;
      }
  }

home.scss contains something like

    .contentSliderContainer {
        width: 100%;
        @include biggerMobile() { 
            width: 80%;
        }  
    }

package.json contains scripts like:

    "cssDev": "node-sass --output-style compact ./src/home/css/main.scss ./src/home/css/main.css",
    "cssWatch": "node-sass --output-style compact --line-numbers --watch ./src/home/css/main.scss -o ./src/home/css/",

running cssWatch results in an output like that (using yarn, but npm is doing the same):

    => changed: /...../src/home/css/scss/home.scss
    => changed: /...../src/home/css/main.scss
    {
    "status": 1,
    "file": "/...../src/home/css/scss/home.scss",
    "line": 7,
    "column": 14,
    "message": "no mixin named biggerMobile",
    "formatted": "Error: no mixin named biggerMobile\n        on line 7 of src/home/css/scss/contentSlider.scss\n>>     @include biggerMobile() { \n\n   -------------^\n"
    }
    Rendering Complete, saving .css file...
    Wrote CSS to /...../src/home/css/main.css

However, the file is properly written, containing the mixin's condition!
If i run cssDev the main.css is written without any issues.

Any explanation for that behaviour?

@saper
Copy link
Member

saper commented Oct 22, 2019

This is #2560 again. Everything works properly if only main.scss is touched.

Workaround: use _home.scss and _mixins.scss as module names.

@saper saper closed this as completed Oct 22, 2019
@wende60
Copy link
Author

wende60 commented Oct 23, 2019

Ahh. I had to remember this: underscore prefix turns an imported sass-file into a partial, which should be done anyways for performance optimization. Thanks!

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

No branches or pull requests

2 participants