FullHuman / purgecss-webpack-plugin

Purgecss plugin for webpack
MIT License
297 stars 15 forks source link

Purgecss should not remove html style #69

Open edwardanthony opened 5 years ago

edwardanthony commented 5 years ago

Version: 1.4.0 Platform: MacOS 10.13.6

How to reproduce

Note: Please notice the difference between "purecss" and "purgecss" as it looks similar.

  1. Install purecss library

    npm install purecss --save
  2. Add component.js

    export default (text = 'Hello world') => {
    const element = document.createElement('div');
    
    element.className = 'pure-button';
    element.innerHTML = text;
    
    return element;
    };
  3. Add this in index.js entry point.

    
    import 'purecss';
    import './main.scss';

import component from './component';

document.body.appendChild(component());


### Purgecss wil purge the css, including the html style.
Below you could see the html style that is removed by Purgecss.

html { font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }



Because html style is removed, the font will look different after purging.
ghost commented 4 years ago

Happened to me too. For some reason deletes all htmltag styles, and I solved it adding the following option:

whitelist: ['html']