trimCustomFragments and content in quotes
See original GitHub issueI wonder if it’s somehow possible to tell trimCustomFragments
to not trim inside quotes. Example:
"use strict";
console.log(require('.').minify(`
<div id="list {{name}}-list">
{{name}}
</div>
`, {
ignoreCustomFragments: [/{{.*?}}/],
collapseWhitespace: true,
trimCustomFragments: true,
}));
This results in a broken class attribute:
<div class="list{{name}}-list">{{name}}</div>
With trimCustomFragments
set to false
, the class is correct, but there’s whitespace (which leads to unwanted text nodes being created) on the tag content:
<div class="list {{name}}-list"> {{name}} </div>
I also attempted to set ignoreCustomFragments
to include quotes through [/".*?{{.*?}}.*?"/]
, but that leads to a double quoting issue (while trimming correctly):
<div class=""list {{name}}-list"">{{name}}</div>
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Extended Rules for Using Quotation Marks - Purdue OWL
Inaccurate quotes not only defeat the purpose of using a quote, they may also constitute plagiarism. However, there are approved methods for altering...
Read more >Quotation Marks for Emphasis
Quotation marks within an emphatic context should tell readers that the content in quotes means something other than what it usually would.
Read more >quotes - CSS: Cascading Style Sheets - MDN Web Docs
The quotes CSS property sets how the browser should render ... The open-quote and close-quote values of the content property produce no ...
Read more >Quotation Marks and Direct Quotations - University of Sussex
The use of quotation marks, also called inverted commas, is very slightly complicated by the fact that there are two types: single quotes...
Read more >Punctuation: Quotation Marks | Writing Style Guide
Double quotation marks are used for direct quotations and titles of compositions such as books, plays, movies, songs, lectures and TV shows.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Looking good, I’ll test that further.
One tweak:
{{2,}.*?["'].*?}{2,}
so it also matches{{{triple}}}
and more curly pairs.Thanks for letting me know of your use cases. Always good to keep tap especially around features which I don’t get to use myself.