es128 / progeny

:baby: Recursively finds dependencies of style and template source files
MIT License
29 stars 15 forks source link

Sass @imports don't require quotes #1

Closed jkbrzt closed 10 years ago

jkbrzt commented 10 years ago

For example, this a valid .sass import:

@import partials/layout

But it doesn't get matched by the import reqex:

 /^\s*@import\s+['"](.*)['"]/

It should be something like:

/^\s*@import\s+['"]?(.*?)['"]?/
es128 commented 10 years ago

Really? I don't see any example like that in the sass documentation: http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import.

I'll try it out though, and if I can validate that works I'll tweak the regex.

es128 commented 10 years ago

Nope

29 Jul 11:11:41 - error: Compiling of 'vendor/styles/parent.scss' failed. Syntax error: Invalid CSS after "@import ": expected file to import (string or url()), was "_children/layout;"
        on line 7 of standard input
  Use --trace for backtrace.

Although this is true of stylus, and I will be fixing it there.

jkbrzt commented 10 years ago

Yep ;) There is a difference between .scss and .sass (the indented syntax).

Please see the docs:

@import The @import directive in Sass does not require quotes, although they may be used. For example, this SCSS:

@import "themes/dark";
@import "font.sass";

would be this Sass:

@import themes/dark
@import font.sass
jkbrzt commented 10 years ago

I didn't notice your first comment: Yes, it's difficult to find in the docs but the quotes are really optional (link in my previous comment).

es128 commented 10 years ago

Ok I was trying it in .scss.