andrewrk / juice

Juice inlines CSS stylesheets into your HTML source.
MIT License
60 stars 13 forks source link

bugfix: short *one* stylesheet due to off by 1 error, when juice'n #1

Closed andxyz closed 10 years ago

andxyz commented 10 years ago
andxyz commented 10 years ago

Hi Andrewrk,

I was importing 3 stylesheets total, 2 in my base.html:

<link rel="stylesheet" href="normalize.css" />
<link rel="stylesheet" href="email-base.css" />

and 1 in my invitation.html:

<link rel="stylesheet" href="invitation.css" />

However, once swig-email-templates was all done rendering (here is a snippet of my call, I was using expressjs to serve up my local emails in a little side application to my main application, to test this all out):

app.get('/invitation', function(req, res){

  emailTemplates(options, function(err, render) {

    var emailFile = 'invitation.html';

    render(emailFile, context, function(err, html) {
      if (err) return console.log(err);

      writeToFile('saved-' + emailFile, html);
      res.send(html);
    });
  });

});

"swig-email-templates": "~1.0.1", had skipped importing the email-base.css. I hunted it down to a small bug in getStylesheetList. The above patch fixed my issue.

Great F * * K ing Project by the way. Email templates are the worst, and this little setup has saved me a ton of time.

andrewrk commented 10 years ago

Released in juice2@0.5.1. Thanks for the patch.

andxyz commented 10 years ago

Sick. You rule. Really making life easy on me, over here.