purifycss / grunt-purifycss

Remove unused CSS with the grunt build tool
MIT License
163 stars 21 forks source link

Ignore certain css rules #8

Closed Malm closed 8 years ago

Malm commented 9 years ago

Is it possible to ignore some rules in my css? I have a couple white are set through combining strings and template-variables like icon-{{role}} which results in eg. .icon-admin.

Perhaps wrap some rules in css comments like

/* ignore */
.icon-admin {}
.icon-user {}
/* endignore */
msantoro12 commented 8 years ago

I am having the same issue in marrionette for backbone. I am setting a class via a url variable.

  className: function() {
    var header = window.location.search.match(/header\=([0-9])/),
        headerNumber = header ? header[1] : 1;

    this.headerVar = headerNumber;

    // these trick it for now
    // header1 header2 header3
    return 'home-page header' + headerNumber;
  }

Trick from here

kennyt commented 8 years ago

There is a whitelist feature now. See here