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

Un-quoted sass imports are not watched. #1179

Closed
changemewtf opened this issue Sep 24, 2015 · 8 comments
Closed

Un-quoted sass imports are not watched. #1179

changemewtf opened this issue Sep 24, 2015 · 8 comments

Comments

@changemewtf
Copy link

With this file structure:

.
|-- package.json
|-- public
|   `-- index.css
`-- styles
    |-- account.sass
    `-- index.sass

And this code:

/* styles/index.sass */
@import account
/* styles/account.sass */
body
  background: purple

And this command line:

node-sass -wr styles/index.sass public/index.css

Making a change in styles/account.sass will not trigger a rebuild of public/index.css.

The dependency tree is cached when node-sass first runs, so adding quotes does not add a watch bit to styles/account.sass until you re-run the command. Don't be fooled by the rebuild triggered when you save styles/index.sass after adding quotes.

Version info:

$ node-sass --version
node-sass       3.3.3   (Wrapper)       [JavaScript]
libsass         3.2.5   (Sass Compiler) [C/C++]
@saper
Copy link
Member

saper commented Sep 24, 2015

Is it better with .scss maybe?

@snuggs
Copy link

snuggs commented Sep 25, 2015

Interesting @saper however why would this even matter? File types should be superfluous. That said...I've ran into situations where semicolons and curly braces ARE REQUIRED. which would NOT be SASS but SCSS. /cc @mcantor

That said, kinda ironic SASS recommends SCSS instead of SASS. The ruby SASS compiler allows

@import foo /* ruby sass */
@import "foo" /* this DOES work with node sass. Not without quotes */

Isn't node sass a port of ruby sass?

@saper
Copy link
Member

saper commented Sep 25, 2015

Interesting @saper however why would this even matter? File types should be superfluous. That said...I've ran into situations where semicolons and curly braces ARE REQUIRED. which would NOT be SASS but SCSS.

That said, kinda ironic SASS recommends SCSS instead of SASS. The ruby SASS compiler allows

@import foo /* ruby sass */
@import "foo" /* this DOES work with node sass. Not without quotes */

Isn't node sass a port of ruby sass?

My question was not about what is right or wrong, I just wanted to see if the bug
concerns all formats or is it some problem with sass-graph not understanding indented
syntax properly.

@snuggs
Copy link

snuggs commented Sep 25, 2015

Again @saper converting to SCSS forces the requirement to use semicolons and curly braces if i'm not mistaken. /cc @mcantor

@changemewtf
Copy link
Author

I'm not at the right machine to test this, but @saper I'm assuming that switching to .scss would work because it is a syntax error to have unquoted imports in scss format.

In this case, the sass parsing process does not throw an error (because unquoted imports are valid indented syntax), but the code that generates the dependency graph seems to be running on different rules.

@saper
Copy link
Member

saper commented Sep 25, 2015

Related issue xzyfer/sass-graph#22

saper added a commit to saper/sass-graph that referenced this issue Sep 25, 2015
sass-graph should understand idented
syntax better.

sass/node-sass#1179
saper added a commit to saper/sass-graph that referenced this issue Sep 25, 2015
@saper
Copy link
Member

saper commented Sep 25, 2015

So it looks like https://github.com/xzyfer/sass-graph does not support indented syntax really.

Filed xzyfer/sass-graph#31

@saper
Copy link
Member

saper commented Oct 18, 2019

Should be fixed after xzyfer/sass-graph#70

> /home/saper/node_modules/node-sass/bin/node-sass -wr styles/index.sass public/index.css

=> changed: /home/saper/sw/node-sass-issues-1179/styles/account.sass
=> changed: /home/saper/sw/node-sass-issues-1179/styles/index.sass
Rendering Complete, saving .css file...
Rendering Complete, saving .css file...
Wrote CSS to /home/saper/sw/node-sass-issues-1179/public/index.css
Wrote CSS to /home/saper/sw/node-sass-issues-1179/public/index.css
=> changed: /home/saper/sw/node-sass-issues-1179/styles/account.sass
=> changed: /home/saper/sw/node-sass-issues-1179/styles/index.sass
Rendering Complete, saving .css file...
Rendering Complete, saving .css file...
Wrote CSS to /home/saper/sw/node-sass-issues-1179/public/index.css
Wrote CSS to /home/saper/sw/node-sass-issues-1179/public/index.css
=> changed: /home/saper/sw/node-sass-issues-1179/styles/index.sass
Rendering Complete, saving .css file...
Wrote CSS to /home/saper/sw/node-sass-issues-1179/public/index.css

@saper saper closed this as completed Oct 18, 2019
jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
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

4 participants