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

node-sass is compiling the directory recursively even without the flag #2504

Closed
ltlombardi opened this issue Oct 1, 2018 · 8 comments
Closed

Comments

@ltlombardi
Copy link

ltlombardi commented Oct 1, 2018

How to execute
node-sass --watch ./src/main/css --output ./src/main/css
where ./src/main/css can be any directory you want that has sass files.

Result
Watches and compiles all the .scss in the directory and it's sub-directories, i.e. recursively.

Expected
Should watch for changes and only compile the .scss files in the directory, not the ones present in the sub-directories, i.e. non-recursively / without recursion.


To give more details as to how and why:
My app follows the BEM methodology with sass, and because of that I have a styles folder structure like this (screen from vscode IDE). I use node-sass CLI with the IDE:

capture

I need node-sass to watch and compile only the files in the /css folder (app.scss and chartist.scss).
Right now it's compiling also the settings.scss, normalization.scss and all the rest of the .scss files that don't start with the _


When reporting any bug, YOU MUST PROVIDE THE FOLLOWING INFORMATION
or your issue will be closed without discussion

-->

  • NPM version (npm -v): 5.6.0
  • Node version (node -v): v8.11.4
  • Node Process (node -p process.versions):
{ http_parser: '2.8.0',
  node: '8.11.4',
  v8: '6.2.414.54',
  uv: '1.19.1',
  zlib: '1.2.11',
  ares: '1.10.1-DEV',
  modules: '57',
  nghttp2: '1.32.0',
  napi: '3',
  openssl: '1.0.2p',
  icu: '60.1',
  unicode: '10.0',
  cldr: '32.0',
  tz: '2017c' }
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):

module.js:549
throw err;
^

Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at [eval]:1:1
at ContextifyScript.Script.runInThisContext (vm.js:50:33)
at Object.runInThisContext (vm.js:139:38)
at Object. ([eval]-wrapper:6:22)
at Module._compile (module.js:652:30)
at evalScript (bootstrap_node.js:466:27)

  • npm node-sass versions (npm ls node-sass): node-sass@4.9.3
@ltlombardi
Copy link
Author

ltlombardi commented Oct 1, 2018

Even tried this with same result:
node-sass --watch ./src/main/ --output ./src/main/ --recursive false
Although this
node-sass ./src/main/ --output ./src/main/ --recursive false
works as expected. Only the files in the folder were compiled.

@nschonni
Copy link
Contributor

nschonni commented Oct 2, 2018

AFAIK, --recursive flag only affects the watch flag.
General Sass thing, is any stylesheets that are not intended for compilation and only for @import should be _. This doesn't mean this isn't a bug, just a general pattern/comment

@ltlombardi
Copy link
Author

ltlombardi commented Oct 2, 2018

That is not my experience. Here is a screen of what happens with run with o without --recursive false.
I also updated the first post with more information, to explain why I have multiple sass files without the _

untitled

The error in red isn't connected with this subject and isn't relevant.

@nschonni
Copy link
Contributor

nschonni commented Oct 2, 2018

Don't think --recursive false works. The CLI uses https://github.com/sindresorhus/meow so it would probably be --no-recursive

@ltlombardi
Copy link
Author

ltlombardi commented Oct 2, 2018

Also doesn't work, as the picture shows. It's compiling recursively. I made a change in the app.scss file and in settings.scss a file located in a sub-folder:

untitled2

@saper
Copy link
Member

saper commented Oct 17, 2019

Are there any dependencies? For example, is app.scss importing settings/settings.scss

Can you produce a quick repository to reproduce it? (Btw. please copy text output and not images if possible)

@ltlombardi
Copy link
Author

Hey. I'm no longer developing with this ecosystem :-( .
I don't have anymore, files pertaining to it.

@saper
Copy link
Member

saper commented Oct 18, 2019

No worries, we have enough watcher bugs around :) Thank you.

Everybody: please have a look at Module - Watcher and see if there is one that is a duplicate to this one. Test cases welcome!

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

3 participants