remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

Add information on how to use localy #25

Closed TimGeibel closed 9 years ago

TimGeibel commented 11 years ago

Hi!

Finaly managed to install this (had to install command line tools first via xCode). Now I tried to inline a project that is on my localhost. I tried it with these commands:

inliner /Path/to/my/project/root > index.html inliner http://localhost > index.html inliner http://virtual-host.local > index.html

Would normaly all of those commands work? If not, which one should it be? And do I have to be in the project's folder when running this, or should I be in the folder where I want the output to be located or do I just define origin -> target in the command? An example for this case in the readme file would be very helpful.

Besides this being unclear I'm always getting this error (started this script in the folder where I wanted to place the output):

TypeError: Cannot call method 'request' of undefined at Inliner.makeRequest (/usr/local/lib/node_modules/inliner/inliner.js:553:53) at Inliner.get (/usr/local/lib/node_modules/inliner/inliner.js:360:17) at Object.inliner.get.jsdom.env.todo.styles.assets.styles.each.style (/usr/local/lib/node_modules/inliner/inliner.js:153:19) at Function.b.extend.each (http://code.jquery.com/jquery.min.js:3:5257) at b.fn.b.each (http://code.jquery.com/jquery.min.js:3:2013) at /usr/local/lib/node_modules/inliner/inliner.js:150:38 at exports.env.exports.jsdom.env.scriptComplete (/usr/local/lib/node_modules/inliner/node_modules/jsdom/lib/jsdom.js:207:39) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Thx for any help/info.

remy commented 11 years ago

How did you install this? It should just be:

  1. Install node (from nodejs.org)
  2. npm install -g inliner (on all platforms)
  3. inliner >

All those commands you listed should work, but if if you're getting errors, I'm not sure it's installed fully...

But yes, one it's installed

On 25 March 2013 13:58, Krunke notifications@github.com wrote:

Hi!

Finaly managed to install this (had to install command line tools first via xCode). Now I tried to inline a project that is on my localhost. I tried it with these commands:

inliner /Path/to/my/project/root > index.html inliner http://localhost > index.html inliner http://virtual-host.local > index.html

Would normaly all of those commands work? If not, which one should it be? And do I have to be in the project's folder when running this, or should I be in the folder where I want the output to be located or do I just define origin -> target in the command? An example for this case in the readme file would be very helpful.

Besides this being unclear I'm always getting this error (started this script in the folder where I wanted to place the output):

TypeError: Cannot call method 'request' of undefined at Inliner.makeRequest (/usr/local/lib/node_modules/inliner/inliner.js:553:53) at Inliner.get (/usr/local/lib/node_modules/inliner/inliner.js:360:17) at Object.inliner.get.jsdom.env.todo.styles.assets.styles.each.style (/usr/local/lib/node_modules/inliner/inliner.js:153:19) at Function.b.extend.each (http://code.jquery.com/jquery.min.js:3:5257) at b.fn.b.each (http://code.jquery.com/jquery.min.js:3:2013) at /usr/local/lib/node_modules/inliner/inliner.js:150:38 at exports.env.exports.jsdom.env.scriptComplete (/usr/local/lib/node_modules/inliner/node_modules/jsdom/lib/jsdom.js:207:39) at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Thx for any help/info.

— Reply to this email directly or view it on GitHubhttps://github.com/remy/inliner/issues/25 .

louim commented 11 years ago

I'm having exactly the same problem.

path.existsSync is now called `fs.existsSync`.

/usr/local/share/npm/lib/node_modules/inliner/inliner.js:553
  return http[oURL.protocol.slice(0, -1) || 'http'].request(options);

And after I get the exact same error that @Krunke

trying to run http://localhost:3000 > index.html

Installed as per the instructions.

TimGeibel commented 11 years ago

Ok, here my steps installing, a little more detailed: At first I got errors when trying to install inliner with the command 'npm install inliner -g' (node was allready installed). After failing with that I tried to install both jsdom and uglify-js manually. That worked fine but unfortunately I still wasn't able to install inliner. After some searches on the web I found a hint that I would have to install command line tools first. After doing that I was able to install inliner. But running inliner I get the above listed errors. Also with those lines @louim posted before that error. I also noticed that the target file was completely empty. Could this have something to do with the OS and or node.js Version?

My OS: OS X 10.8.3 My node.js: v0.8.14

ihrke commented 11 years ago

I have the same problem. Also on OS X 10.8, node.js v. 0.10.17. Error:

/usr/local/lib/node_modules/inliner/inliner.js:553 return http[oURL.protocol.slice(0, -1) || 'http'].request(options); ^ TypeError: Cannot call method 'request' of undefined at Inliner.makeRequest (/usr/local/lib/node_modules/inliner/inliner.js:553:53) at Inliner.get (/usr/local/lib/node_modules/inliner/inliner.js:360:17) at Object. (/usr/local/lib/node_modules/inliner/inliner.js:153:19) at Function.x.extend.each (http://code.jquery.com/jquery.min.js:4:5347) at x.fn.x.each (http://code.jquery.com/jquery.min.js:4:1999) at /usr/local/lib/node_modules/inliner/inliner.js:150:38 at /usr/local/lib/node_modules/inliner/node_modules/jsdom/lib/jsdom.js:207:39 at process._tickCallback (node.js:415:13)

remy commented 9 years ago

This is fixed @ 1.0.0.