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

Is it possible to update stats.includedFiles in case of compilation error ? #528

Closed
akiran opened this issue Nov 10, 2014 · 6 comments
Closed

Comments

@akiran
Copy link
Contributor

akiran commented Nov 10, 2014

As of now, stats.includedFiles are updated only if compilation is successful and it is empty if compilation fails.

This is required in watcher tools built on top of node-sass.
In sass-loader for webpack, stats.includedFiles is used to track dependencies.
webpack-dev-server (watcher) is not working because stats.includedFiles is empty in case of error .
So, we had to use external packages like sass-graph, just to parse dependencies which is causing some issues ( webpack-contrib/sass-loader#29 ).

This problem can be solved if stats.includedFiles is updated even in case of errors.

@jhnns
Copy link
Contributor

jhnns commented Nov 10, 2014

I've added std::cout << ctx->num_included_files << std::endl; at this line and it seems like libsass is passing 0 when there was a syntax error. So this needs to be added at libsass...

@akiran
Copy link
Contributor Author

akiran commented Nov 11, 2014

@am11, @kevva Can I add test for this in node-sass ?

@kevva
Copy link
Member

kevva commented Nov 11, 2014

It's not node-sass related so no, probably doesn't belong here.

@am11
Copy link
Contributor

am11 commented Nov 11, 2014

@akiran, this feature request belongs to libsass. Node-sass is just a wrapper around libsass.

I think it might not be possible in all cases from AST point of view, because if the error occurs during the initial parse, the AST will throw and the sass-context (which collects all such information) would be empty. So in the situation, when the initial parse passes, I/O ops succeeded, import-chain is traversed and the compiler errors are collected by context, it might be able to return the desired includedFiles.

@jhnns
Copy link
Contributor

jhnns commented Nov 11, 2014

For the described use-case I think it's important to have all the included files until the syntax error occurred and that should be possible in any case.

@akiran
Copy link
Contributor Author

akiran commented Nov 11, 2014

In case of watcher tools, compilation temporarily enters error state while typing code and reverts back to success state after completion of statement

As @jhnns mentioned, it is useful to provide the available included files.
opened this issue at libsass sass/libsass#638

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