-
Notifications
You must be signed in to change notification settings - Fork 1.3k
cmd-line: Recursive option doesn't work as expected #601
Comments
You might need to use it along with the |
Right, but this is part of a package.json build script, so I'm not watching the files. Watch and recursive should probably be independent options. If not, perhaps the docs/command should be updated to the following?
|
Nah, but |
Also, even with *.scss, it only outputs the first file it finds and saves it as .scss, overwriting the original file. Perhaps this is a different (but serious) issue.
Two problems:
Given the seriousness of the bug (it permanently deletes my un-committed changes without warning), I don't feel comfortable trusting this module in my build script. For now I'm switching back to plain .css. |
@egtann, for the original issue reported. I would consider as a feature request (to provide recursively compile all files in given directory structure) rather than a bug. :) I have added it in 2.1 milestone. https://github.com/sass/node-sass/milestones. The second issue you have reported is fixed. I don't have the exact commit reference handy But this is what I get with the latest build (v2.0.0-beta): C:\temp1> .\node_modules\.bin\node-sass --version
2.0.0-beta
C:\temp1> .\node_modules\.bin\node-sass -r \temp\foo.scss -o ./
Rendering Complete, saving .css file...
Wrote CSS to foo.css Also, we do not have glob paths support as well as directory for input file yet. For watch, we certainly do: node-sass#L170. This may also effect our watch implementation (#629) as follow:
This way user would be able to watch any directory and output to any directory, regardless of Thoughts? |
To be honest I'm not sure why there is a I gut feeling is that this flag is a hold over from the broken watcher implementation pre 2.0.0. With the new smart watcher my vote would be for removing the recursive option and being recursive by default. |
@xzyfer, do you think retiring I believe there are use cases where the user would want to watch-compile or instant-compile (this feature request) only the current directory. Going by laws of "separation of concern", I also think having a separate no resursive for watch and instant (regular/no-watch) options would make sense (although they are mutually exclusive use-cases: watch-compile & non-watch-compile). |
I'm unconvinced there's a use case for non recursive watching or I consider Ruby Sass as the gold standard here because it covers 5 years of I'm not saying if you give people the option they won't use it, but I don't
|
@xzyfer, that makes sense. I think we can live without non-recursion if Sassy Ruby say so. :) |
I also need to build multiple sass files into multiple css files. Is that possible right now? Something like:
or even:
|
Also, I agree with @xzyfer that non-recursive watching is probably not needed. I've never needed that. |
The syntax surrounding watching files and directories is confusing and mostly undocumented. Is there any reason not to use the same CLI syntax that Ruby sass uses?
(from http://sass-lang.com/documentation/file.SASS_REFERENCE.html#using_sass)
I would at least expect to be able to do something like
Either way, we should agree on a clear syntax and document it properly. |
I also agree with @xzyfer that |
@egtann said:
I do not think it does? We do not support multi-file compilation nor do we support glob in CLI arguments. However, we do create glob magic internally and then pass it to Nonetheless, I tried implementing multi-file compilation with globs and no matter how we slice it, there are blockers like: (Considering glob can accept patterns like:
For this, I solved the least common denominator problem for FS paths but still it will not help as inevitably it will present another set of customizations demand, which is way out of scope IMO. So frankly the original concern to use recursive without watch, conversely: multi-file compilation support, cannot be entertained. The solution is to use bash/cmd loops or grep to invoke node-sass iteratively (or recursively) for each file falling under the intended pattern. Does anyone have objection with this? Other things that can be done to improve current CLI experience:
Thoughts / ideas? |
For those watching this thread who need multiple-file compilation, I wrote a small cli that provides that functionality: https://github.com/paulcpederson/scss-cli Made it for my own use, but published to npm in case others needed this type of functionality. Right now it has no watch capabilities. |
@paulcpederson many thanks for scss-cli |
This is fixed by 4ed6de2 via #782. Credit goes to @wesleytodd. We finally ended up making the recursive a default option and decided not to drop it as some people still want this behavior. Apparently, people are not 100% satisfied with ruby-sass CLI either.. |
Tested with node-sass@1.2.3 and @2.0.0-beta, which both seem to have the issue.
Steps to reproduce:
Expected behavior: I should be able to pass in a folder with the recursive option.
Edit: I see now that --recursive is just for watching files. You might consider making it apply to inputs as well, which is the expected behavior from normal cmd-line tools (cp, chmod, etc.).
The text was updated successfully, but these errors were encountered: