gulp-inline-css
gulp-inline-css copied to clipboard
Don't remove link with attribute data-embed
Hi, I have small wish :) I am newsletter developer a I use gulp-inline-css in my devstack with two cases. First I have external link to style.css () which I need to inline and remove. And second external link for Google Fonts () which I don't want remove.
I tried to add data attribute data-embed, but it still remove element.
Can you help me, please?
I second this request. My links to to Google fonts get stripped out.
This option doesn't work?
https://github.com/jonkemp/gulp-inline-css#optionsremovelinktags
Oh I see what you are saying. Seems like data-embed is the solution here but maybe it doesn't work for the link tag.
Maybe having an data-embed-ignore attribute for link tags to be left alone entirely. Thank you for looking into this!
Any updates? Same problem with Google fonts
Curious if this is being addressed? Also having a problem with Google Fonts being stripped.
Also came here for the same issue, want to ignore certain link tags, like google fonts.
UPDATE
If you use data-embed="" in a Google webfont <link>, it won't be stripped. Here are the steps...
Step 1: make sure rel="stylesheet" isn't in the <link> attribute (will interrupt gulp-inline-css)
Step 2: add inline-webfontlink="" as a place holder so we can add the rel="stylesheet" back in later or else the webfont won't render (see 1st image, below)
Step 3: add data-embed="" to the <link> after the inline-webfontlink="" declaration (see 1st image, below)
Step 4: make sure your gulp-inline-css settings are correct (see 2nd image, below)
Step 5: add .pipe(replace(/inline-webfontlink="(.*)"/g, 'rel="stylesheet"')) as the last item in your var inline = function(path) { (see 3rd image, below)
Step 6: view source of rendered code to confirm (see 4th image, below)
1. HTML:
2. Settings:
3. var inline:
4. Rendered:
Credit in part to @chrisgrouge