source: frontend/node_modules/postcss-discard-comments/src/lib/commentRemover.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 690 bytes
Line 
1'use strict';
2
3/** @param {import('../index.js').Options} options */
4function CommentRemover(options) {
5 this.options = options;
6}
7/**
8 * @param {string} comment
9 * @return {boolean | undefined}
10 */
11CommentRemover.prototype.canRemove = function (comment) {
12 const remove = this.options.remove;
13
14 if (remove) {
15 return remove(comment);
16 } else {
17 const isImportant = comment.indexOf('!') === 0;
18
19 if (!isImportant) {
20 return true;
21 }
22
23 if (this.options.removeAll || this._hasFirst) {
24 return true;
25 } else if (this.options.removeAllButFirst && !this._hasFirst) {
26 this._hasFirst = true;
27 return false;
28 }
29 }
30};
31
32module.exports = CommentRemover;
Note: See TracBrowser for help on using the repository browser.