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

Watch a file with output to file creates an empty file first #1852

Closed
kottenator opened this issue Jan 8, 2017 · 3 comments
Closed

Watch a file with output to file creates an empty file first #1852

kottenator opened this issue Jan 8, 2017 · 3 comments

Comments

@kottenator
Copy link

kottenator commented Jan 8, 2017

When I do:

node-sass -w input.scss > output.css

It initially creates and empty file output.css until a change in input.scss.

File input.scss is not empty: node-sass input.scss > output.css creates correct output.css.

So I can't watch it. When I do:

node-sass input.scss > output.css && node-sass -w input.scss > output.css

... it first builds the correct one but then immediately erases it and waits until a change.

I think it's a bug in node-sass client. Could you, please, check?

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
@kottenator kottenator changed the title Watch a file with output to stdout creates an empty file first Watch a file with output to file creates an empty file first Jan 8, 2017
@citrusui
Copy link

citrusui commented Jan 8, 2017

Also happening on my end. Specs:

npm -v
4.0.5
node -v
v7.4.0
node -p process.versions
{ http_parser: '2.7.0',
  node: '7.4.0',
  v8: '5.4.500.45',
  uv: '1.10.1',
  zlib: '1.2.8',
  ares: '1.10.1-DEV',
  modules: '51',
  openssl: '1.0.2j',
  icu: '58.2',
  unicode: '9.0',
  cldr: '30.0.3',
  tz: '2016j' }
node -p process.platform
linux
node -p process.arch
x64
node -p "require('node-sass').info"
node-sass       4.1.1   (Wrapper)       [JavaScript]
libsass         3.4.0   (Sass Compiler) [C/C++]

@kottenator
Copy link
Author

After I've played more with it, there is a bigger problem - node-sass -w input.scss > output.css appends changes to output.css incrementally, not overrides its contents.

And I believe it's correct POSIX FD redirection behavior.

So, one shouldn't use node-sass -w > ... combination.

And I make a conclusion that there is no way to do watch with output to a single file :(

@kottenator
Copy link
Author

I'm closing this ticket as invalid (see my previous comment). But I've created another one - #1853, which describes another equivalent problem.

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

2 participants