0

I have a webpack bundled react app and am trying to slim down its css that's extracted using PurifyCSS library. However, I'm not having much success with running the PurifyCSS CLI as it appears to be removing too much css.

For example, it's removing this line from my bundled css file:

brand-card img{height:50px;width:50px;}

Even though this is used in my bundled js file:

_react2.default.createElement(
    'div',
    { className: 'brand-card' },
    _react2.default.createElement('img', { src: (0, _index.getUserImageThumbnailUrl)(userId, 2) }),
    spaceOwner,
    _react2.default.createElement(
        'div',
        { className: 'brand-card__description' },
        description
    )
),

Is PurifyCSS not robust enough to handle these cases?

MarksCode
  • 8,074
  • 15
  • 64
  • 133
  • I'd check your pipeline configuration and make sure that PurifyCSS is getting the javascript file, because this looks like a pretty base case that PurifyCSS should handle. Also, maybe include your build configuration (web pack, gulp, unix command used, etc) so we can check that. – Garrett Motzner Aug 22 '18 at 21:54
  • Hey Garett, I'm actually running the CLI on the bundled files like this `purifycss brands.bundle.css brands.bundle.js --info --out ./test.css`. Was going to try actually integrate it into my webpack build process once I confirmed this was working. – MarksCode Aug 22 '18 at 21:56

0 Answers0