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

No way to output to a single file when watching #1853

Closed
kottenator opened this issue Jan 9, 2017 · 9 comments
Closed

No way to output to a single file when watching #1853

kottenator opened this issue Jan 9, 2017 · 9 comments

Comments

@kottenator
Copy link

kottenator commented Jan 9, 2017

After my experiments (#1852) I found that node-sass -w input.scss > output.css is a wrong way to go (due to POSIX file descriptors redirection logic).

So currently there is no way to output changes into a single file when using --watch option.

Environment

  • NPM version (npm -v): 3.10.3
  • Node version (node -v): v6.3.0
  • Node Process (node -p process.versions):
{ http_parser: '2.7.0',
  node: '6.3.0',
  v8: '5.0.71.52',
  uv: '1.9.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  icu: '57.1',
  modules: '48',
  openssl: '1.0.2h' }
  • 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.1.1	(Wrapper)	[JavaScript]
libsass  	3.4.0	(Sass Compiler)	[C/C++]
  • npm node-sass versions (npm ls node-sass): node-sass@4.1.1
@xzyfer
Copy link
Contributor

xzyfer commented Jan 12, 2017

What are you suggesting?

@kottenator
Copy link
Author

Maybe to allow -o file.css? (or some new argument for that).

@xzyfer
Copy link
Contributor

xzyfer commented Jan 12, 2017

I see. We do have an -o flag but I believe it only works when watching a directory. It makes sense that it should work individual files as well

@steezeburger
Copy link

I came across this today. Even when pointing the input to one file, it watches the whole directory (seemed to be recursive even though I didn't have the -r flag) and creates a .css file in my output directory FOR EACH FILE.

So node-sass --watch sass/styles.scss --output css didn't just create css/styles.css it created a css file for everything in sass/.

Even without the option for -o filename.css why would it create an output file for anything but my entry? Everything is imported in that one styles.scss, so now I have a ton of extra files dirtying the project. The other option being to not use watch.

@steezeburger
Copy link

Note: you can get around this somewhat by prefixing all imported sass files with a _ which lets sass know it is a partial and should not be generated into a css file.

@sinedied

This comment has been minimized.

@saper
Copy link
Member

saper commented Oct 17, 2019

What about this:

 node-sass -w in/main.scss out/main.css

This works for me as of 4.12. There are some issues like #2491 or #2560 but in the most general case it works.

@saper saper closed this as completed Oct 17, 2019
@kottenator
Copy link
Author

The problem was that I had multiple files to watch for changes but only one file to recompile.

@saper
Copy link
Member

saper commented Oct 18, 2019

So this is the same as this #2492 (comment) I think

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

6 participants