Breaking change in 1.3.0
Howsterz opened this issue · 4 comments
Our Gulpfile.js was working perfectly with gulp-inline-source 1.2.0. Changing to 1.3.0 caused an issue due to the way that the rootpath is now calculated (I think). Here is the current output when running gulp:
$ gulp --gulpfile ./web/public/message_templates_source/Gulpfile.js inline-javascript-into-message-template
[18:02:54] Working directory changed to /Volumes/workspace/project/web/public/message_templates_source
[18:02:55] Using gulpfile /Volumes/workspace/project/web/public/message_templates_source/Gulpfile.js
[18:02:55] Starting 'inline-javascript-into-message-template'...
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/Volumes/workspace/project/web/styles/common.css'
The file that gulp-inline-source cannot find, common.css
, is not located in /Volumes/workspace/project/web/styles
, but actually exists in the directory /Volumes/workspace/project/web/public/message_templates_source/styles
. If I run gulp in the directory where the Gulpfile.js lives, I still have the same issue:
$ cd web/public/message_templates_source/
$ gulp inline-javascript-into-message-template
[10:59:06] Using gulpfile /Volumes/workspace/project/web/public/message_templates_source/Gulpfile.js
[10:59:06] Starting 'inline-javascript-into-message-template'...
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open '/Volumes/workspace/project/web/styles/common.css'
This is why I believe the change in the rootpath option caused this problem. Changing all inlined scripts in my html files seems to help, but not totally solve the problem. Oddly, changing something like this:
<link inline rel="stylesheet" href="../../styles/common.css" />
to this,
<link inline rel="stylesheet" href="./../../styles/common.css" />
by adding an extra ./
(which should not be necessary), seems to help, but gulp still fails with the same error on a different file.
This doesn't seem an error in the way that gulp-inline-source works, but it is certainly a breaking change. So I would really appreciate it if you could:
- document this change and how to ensure code continues to work in the README.
- re-release this as 2.0.0, in keeping with semantic versioning (minor version changes should not introduce breaking changes).
Thank you!
I'm having the same issue! I tried messing with the rootpath option, since the OP mentioned that they thought it might be causing the issue, but it didn't help. Relative paths are definitely not working though.
I had the same issue. Solved it by going back to v1.2.0.
It can be fixed by assign the htmlpath
exactly.
First of all, forgive me the late response - I've been quite busy lately. The reason why I changed the rootpath
was because I couldn't get tests to pass after updating inline-source dependency. With file.base
my tests pass, so I haven't noticed the breakage. I've updated tests to catch this issue and fixed the plugin (thanks @yuezk). I've also updated inline-source and released plugin as 2.0.0. Again, sorry for causing you any trouble.