furzeface / gulp-cache-bust

⚠️ not maintained
35 stars 21 forks source link

Not running on items within conditional comments #16

Closed lnpbk closed 7 years ago

lnpbk commented 8 years ago

I'm running gulp-cache-bust on a few of my templates, and noticed that it doesn't find files within conditional comments.

<link rel="stylesheet" href="/assets/css/main.css?t=1478689011510">
<link rel="stylesheet" href="/assets/css/print.css?t=1478689011510" media="print">
<!--[if (IE)|(IEMobile)]>
<link rel="stylesheet" href="/assets/css/ie.css">
<![endif]-->
davinkevin commented 8 years ago

We use cheerio and a specific selector to get all the link and script tag (https://github.com/furzeface/cachebust/blob/master/lib/cachebust.js#L51), and I think these elements aren't handle by cheerio natively.

I will try to see if cheerio can select this kind of elements.

davinkevin commented 8 years ago

It won't be supported by cheerio because the conditional comment is not even used by Edge, but a trick have been found https://github.com/claudetech/node-static-i18n/commit/1e37ce45a83cef8ab147d8c8785268bf8f670ad3#diff-2fbc5085a7bbe6fb696a1a3b75a6f420R129 to do this.

If some of you would like to do a PR in the cache-bust project, it's welcome : https://github.com/furzeface/cachebust

davinkevin commented 7 years ago

Maybe a solution which create the comment after the cache-bust plugin could be simpler...

For now, I close this issue due to non support of underlying implementation (cheerio)