Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd library css gets removed #61

Closed
mapsgeek opened this issue Sep 18, 2019 · 2 comments
Closed

3rd library css gets removed #61

mapsgeek opened this issue Sep 18, 2019 · 2 comments

Comments

@mapsgeek
Copy link

mapsgeek commented Sep 18, 2019

I'm importing mapbox-gl.js library into a vue component using

<style>
@import "mapbox-gl/dist/mapbox-gl.css";
#map {
  height: 500px;
  width: 500px;
}
</style>

as the library needs all its css stuff to render the map and controls right, purgecss removes all of them, i tried to use whilelist with no luck preventing this from happening as so:

in nuxt.config.js

 purgeCSS: {
    whitelist: [
      'swiper-container',
      'mapbox-gl',
      'mapboxgl-canvas-container',
      'mapboxgl'
    ],
    whitelistPatterns: [/mapboxgl\-/, /map\-/]
  },

i tried to use /* purgecss ignore */ in the css file itself but also got no luck, in production no css for the library is available, any suggestions ? thanks

Environment:

    "nuxt": "^2.9.2",
    "nuxt-purgecss": "^0.2.1",
@Scaalees
Copy link

Scaalees commented Oct 11, 2019

I had the same issue whitelisting the class didn't do anything for me.

I've ended up using whitelistPatterns and selecting all with regex - .*

purgeCSS: {
        whitelistPatterns: [/mgl-map-wrapper.*/, /mapboxgl.*/]
}

Hope this helps.

@mapsgeek
Copy link
Author

@Scaalees thank you, i ended up removing purgecss completely since it keeps interfering with other UI libraries like Ant Design and cause breakings in its stylings for components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants