-
Notifications
You must be signed in to change notification settings - Fork 581
/
Copy pathremove.js
34 lines (28 loc) · 972 Bytes
/
remove.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* global minify */
'use strict';
if (typeof minify === 'undefined') {
self.minify = require('html-minifier').minify;
}
var input, output;
test('removing comment chunks', function () {
input = '<!-- htmlmin:remove --><!-- htmlmin:remove -->';
equal(minify(input), '');
input = '<!-- htmlmin:remove -->FOOBAR<!-- htmlmin:remove -->';
equal(minify(input), '');
input = '' +
'<div class="wrapper">\n' +
' <p> ignored </p>\n' +
' <!-- htmlmin:remove -->\n' +
' <div class="removed" style="color: red">\n' +
' removed <span> <input disabled/> chunk </span>\n' +
' </div>\n' +
' <!-- htmlmin:remove -->\n' +
'</div>';
output = '' +
'<div class="wrapper">\n' +
' <p> ignored </p>\n' +
// Note there's two spaces that linger before our <!-- htmlmin:remove -->
' \n' +
'</div>';
equal(minify(input), output);
});