Skip to content

Remove unused CSS #37

@TheJaredWilcurt

Description

@TheJaredWilcurt

This would be a top level boolean option on a task { removeUnused: true }. It would also be accompanied by a top level array of selectors to whitelist that will be used by JavaScript { removalWhitelist: [ '.cow .moo', '.dog' ] }.

{
  removeUnused: true,
  removalWhitelist: [
    '.frog'
  ],
  styles: {
    data: `
      .cow {
        padding: 8px;
      }
      .frog {
        padding: 2px;
      }
      .bat {
        margin: 19px;
        background: #F00;
      }
    `,
    result: function (result, err) {
      // .rp__padding__--COLON8px { padding: 8px } .rp__padding__--COLON2px { padding: 2px }
      console.log(result);
    }
  },
  markup: [
    {
      data: '<div class="cow"></div>',
      result: function (result, err) {
        // '<div class="rp__padding__--COLON8px"></div>'
        console.log(result);
      }
    }
  ],
  scripts: {
    result: function (result, err) {
      // { '.cow': [ 'rp__padding__--COLON8px ], '.frog': [ 'rp__padding__--COLON2px' ] }
      console.log(result);
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions