-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] Syntax for ignoring CSS code blocks #387
Comments
Ah, found the initial discussion: #231, it was a PR actually, I only looked at issues 😂 |
🤔 I think we could do it just like PurgeCSS, which has the added benefit of familiarity for web developers. Ignore the entire file - add comment at the very top: /* juice ignore */ Ignore current rule: h1 {
/* juice ignore current */
color: blue;
} Ignore blocks of code: h1 {
color: black;
}
/* juice start ignore */
h2 {
color: pink;
}
h3 {
color: lightcoral;
}
/* juice end ignore */ |
Hmm, looking at this: Lines 60 to 77 in f1ecb95
... [
'strong', // selector
[
// array of objects representing css rules for this selector
{
type: 'property',
name: 'color',
value: 'blue',
position: [Object]
}
]
] However, this code restricts parsing only to actual CSS rules, so comments are never returned by Lines 66 to 73 in f1ecb95
I'm not sure what the syntax for a 'comment' case should be, would this work? [
'comment',
[
{
type: 'comment',
text: ' juice ignore current ',
position: [Object]
}
]
] That might fail if the user needs to inline on a Maybe setting it to Basically, in order to try and support inlining ignoring through CSS comments, I think we need them available in the object returned by What do you think, @jrit? |
mensch returns the comments, so it'd be looking for |
@jrit I remember discussing this way back, but can't find the issue...
What do you think of introducing CSS comments as delimiters for CSS code blocks that Juice should simply skip over?
This could be used in setups where using a
<style data-embed></style>
is not an option.For example, using this with
removeStyleTags: true
:... results in
a[x-apple-data-detectors]
being removed from the<style>
tag.I can't use
data-embed
in this setup, and I need to keepremoveStyleTags: true
, so that I don't leave unnecessary code in my email, thus increasing its weight and the risk of Gmail clipping.What do you think of a PurgeCSS-like CSS comment delimiter, that would mark the start and end of the lines that Juice should not inline and not remove when
removeStyleTags: true
?Something like:
The text was updated successfully, but these errors were encountered: