STSS
STSS copied to clipboard
fixes the way imports are loaded
The imports path resolution is done in an incomplete way, as it only relies on a combination of the current directory (process.cwd()
) and the options.includePaths
that the user might pass.
This PR will use the options.file
parameter to try and guess the right pass of the imported resource. As is, it even makes the options.includePaths
option useless (but it was kept for BC purpose).
:+1:
Hi @xavierlacot,
First off thanks for your time and contributions! Secondly, my sincere apologies for the late response!
Having said that, I'm not entirely sure what it is you're trying to accomplish here. Could you (or someone else) please show me a basic use-case that demonstrates what didn't work before, but will work with this change?
If options.file
was passed, then the path that contains the STSS file will be appended to options.includePaths
already. On first glance it seems your proposed change has no actual effect, but perhaps I'm simply thinking in the wrong direction.
I do see a minor redundancy issue in the current code, but since that touches options.file as well, I won't fix that right away.
Hi Ronald,
Sorry, it has been a long time and I am not sure to remember perfectly.
As far as I can remember, when using stss with @imports in parent- or sub- directories, the path resolution was not made correctly and resulted in file inclusion errors. Using a declarative way to pass the whole path of the included file allows to avoid this concern.
Moreover, this allows to optimize the binding with grunt-stss, as stated in https://github.com/xavierlacot/grunt-stss/commit/fa301fc32c1a995bb504c5d2c97e301b974b0c37