Filepath Bug Fix + Nonblocking Filereads #73
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firstly, thanks for making this!
There's basically 2 changes here and I'm fairly sure that neither should affect the API/documentation, so I think it's a SemVer patch version bump. I do however think these simple changes might save quite a number of people from going mad. =)
Filepath Bug Fix
Previously, the filepath was being changed incorrectly. The extension was being changed from the existing filepath (which pointed to the sass files). The new filepath should actually point to the output file which is in the css directory. I've also moved the code to change the extension into the compass library because otherwise the path passed down to the callback in index doesn't refer to any actually existing file (in the general case).
I suspect this might fix some of the issues people have been running into:
#15
#49
This also seems to fix other issues that arise when you pipe to other gulp packages (e.g. gulp-rename) that rely on the vinyl path being correct.
Non-blocking File-reads
The current approach to reading the CSS files outputted by compass is using fs.readFileSync.
readFileSync should never be called on a node webserver since it blocks the only node thread while I/O is being performed. Changing this code to use fs.readFile which is the asynchronous (non-blocking) version of the function is really straightforward here. Since gulp tasks are meant to be asynchronous in nature, it's just a matter of calling the callback from readFile's own callback.