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

No "style" attributes added #24

Closed phtrivier closed 9 years ago

phtrivier commented 11 years ago

Using this input

 <head>
    <style type="text/css">
      p {
        color : red;
      }  
    </style>
 </head>
 <body>
    <p>This is an HTML p</p>
    <br/>
    <p>Thanks for ready this.</p> 
 <body>
<html>

The output I get is this :

<!DOCTYPE html><html> <head> <style type="text/css"> p{ color :red;}</style> </head> <body> <p>This is an HTML p</p> <br /> <p>Thanks for ready this.</p> <body> <html></html></body></body></html>

I might be wrong, but I expected the "CSS inlining" to return something like

<p style="color ; red">This is an HTML p</p>

Or am I missing something ?

I'm using inliner 0.1.14 with node 0.8.22.

remy commented 11 years ago

I looked in to CSS inlining, but I didn't get very far - i.e. it's not supported.

Equally, if you had 4

tags, then you'd end up with a bigger document than the one you started with. Since the CSS is inline (via the style tag) then inliner still satisfies it's original goal :)

On 11 March 2013 16:31, Pierre-Henri Trivier notifications@github.comwrote:

Using this input

This is an HTML p


Thanks for ready this.

The output I get is this :

This is an HTML p


Thanks for ready this.

I might be wrong, but I expected the "CSS inlining" to return something like

This is an HTML p

Or am I missing something ? I'm using inliner 0.1.14 with node 0.8.22. — Reply to this email directly or view it on GitHubhttps://github.com/remy/inliner/issues/24 .
phtrivier commented 11 years ago

Ok, sorry. So just to make sure I understand, what do you cover by "Pulls JavaScript and CSS inline to HTML" ? Does it mean that if you have many external js / css file, it will put them in a single style tag ?

In this case, how do you cope with mail clients that do not seem to support the <style> tag ? (I read Gmail simply ignores it, maybe it's not the case any more...)

remy commented 11 years ago

To answer your first (two) questions - yes, it inlines to a single file and resolves all the nested includes (in CSS) and puts them a script or style tag.

Re: email clients: I don't use this for email clients. I can see why you're trying to use this (like you said, gmail will strip the style tag), but I don't personally have the resource to try to even begin to make this change! I did look in to it a few years back, but didn't get very far I'm afraid.

On 11 March 2013 17:04, Pierre-Henri Trivier notifications@github.comwrote:

Ok, sorry. So just to make sure I understand, what do you cover by "Pulls JavaScript and CSS inline to HTML" ? Does it mean that if you have many external js / css file, it will put them in a single style tag ?

In this case, how do you cope with mail clients that do not seem to support the