Skip to content

Read content from the stream, not from the filesystem #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2014

Conversation

jfache
Copy link
Contributor

@jfache jfache commented Mar 6, 2014

Hi there,

I wrote a similar plugin before, and you fell into the same trap as I did - reading content from the filesystem versus from the stream.

As of now, if you modify the stream before passing it to gulp-inline-css (let's say, using gulp-replace), the modifications will be lost as gulp-inline-css reads its data from the filesystem (using file.path within its juice call).

Using juice.juiceContent() fixes that issue and actually deals with the stream content.

Let me know if my explanation is clear enough, thanks.

@jonkemp
Copy link
Owner

jonkemp commented Mar 6, 2014

Thanks! Looks good to me, but the build is falling because the tests no longer pass. Any idea why?

@jfache
Copy link
Contributor Author

jfache commented Mar 6, 2014

Having a look right now.

@jfache
Copy link
Contributor Author

jfache commented Mar 6, 2014

Ok, found the issue with the test.
The file.path needs to be absolute so that juice can properly link to the CSS file.

2 options:

  1. We use path.resolve in the test (test/main.js, line 12)
  2. We require path and use path.resolve in the plugin (index.js, line 15)

Option 2 adds a dependency that is useless in most cases, as gulp.src() always returns absolute path. I would go with option 1. What do you think?

@jonkemp
Copy link
Owner

jonkemp commented Mar 7, 2014

Looks good. Not a big deal, but do you know how to squash commits? If you can do that, I would prefer it. Here's instructions on how to do it, if you need them. Thanks.

http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

@jfache
Copy link
Contributor Author

jfache commented Mar 7, 2014

Commits squashed, ready to pull!

jonkemp added a commit that referenced this pull request Mar 8, 2014
Read content from the stream, not from the filesystem
@jonkemp jonkemp merged commit 99824b7 into jonkemp:master Mar 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants