renderComponents :: BL.ByteString -> [Envelope] -> String
renderComponents template envelopes = replaceVars $ CL.unpack template
    where
        heads = concatMap (++ "") $ combineComponents E.head envelopes
        bodyInlines = concatMap (++ "") $ map bodyInline envelopes
        bodyLasts = concatMap (++ "") $ combineComponents bodyLast envelopes
        replaceVars = replace "{{head}}" heads . replace "{{bodyInline}}" bodyInlines . replace "{{bodyLast}}" bodyLasts
renderComponents :: BL.ByteString -> [Envelope] -> String
renderComponents template envelopes = replaceVars $ CL.unpack template
    where
        heads = concatMap (++ "") $ combineComponents E.head envelopes
        bodyInlines = concatMap (++ "") $ map bodyInline envelopes
        bodyLasts = concatMap (++ "") $ combineComponents bodyLast envelopes
        replaceVars = replace "{{head}}" heads . replace "{{bodyInline}}" bodyInlines . replace "{{bodyLast}}" bodyLasts
renderComponents template envelopes = replaceVars $ CL.unpack template
    where
        heads = concatMap (++ "") $ combineComponents E.head envelopes
        bodyInlines = concatMap (++ "") $ map bodyInline envelopes
        bodyLasts = concatMap (++ "") $ combineComponents bodyLast envelopes
        replaceVars = replace "{{head}}" heads . replace "{{bodyInline}}" bodyInlines . replace "{{bodyLast}}" bodyLasts