question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS Not working properly for statically generated site.

See original GitHub issue

I have a nuxt webpage that uses tailwind and vue2-leaflet.

Everything looks fine in development mode (npm run dev) working

However, when I create a static site (npm run generate) and view the dist folder on a local server, the leaflet map doesn’t look correct. The map isn’t loading properly and the markers are spilling out of the map. broken

If I remove tailwind, and re-run npm run generate and view the dist folder (the styling doesn’t look great) but the map is displayed properly.

If anyone knows how to fix this, I would appreciate your help.

PS I chose tailwind as part on the nuxt project installation process.

And I have the following value in nuxt.config.js

devModules: [ // Doc: https://github.com/nuxt-community/nuxt-tailwindcss '@nuxtjs/tailwindcss', ],

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
Atinuxcommented, Aug 8, 2019

After looking at the CSS and installed nuxt-leaflet, you have to set this config:

purgeCSS: {
    whitelist: ['lvml'],
    whitelistPatterns: [/leaflet-.+$/],
    whitelistPatternsChildren: [/leaflet-.+$/]
  }

You can learn more here: https://www.purgecss.com/whitelisting

1reaction
Atinuxcommented, Aug 8, 2019

This module includes purge-css automatically, it’s written in the README: Screenshot 2019-08-08 at 12 03 50

Also written in the README:

If you want to set any (additional) purgeCSS configuration options, you can add a purgeCSS configuration object:

// nuxt.config.js
{
  purgeCSS: {
    whitelist: ['css-selector-to-whitelist'],
  },
}

See full options here: https://github.com/Developmint/nuxt-purgecss#options

Read more comments on GitHub >

github_iconTop Results From Across the Web

Static Site Generation Issue: CSS Styles Applied Differently ...
It's very possible that the ordering of your CSS is different based on which page you load first. Try to narrow it down...
Read more >
Complete list of reasons why a css file might not be working
3. The URL you're using inside your HTML link tag may be unaccessable, so manually try to visit the stylesheet with a browser...
Read more >
CSS working on hugo server but not static pages - support
But when I open the index.html file from the generated /public folder it gives me barebones stock styling as if the css isn't...
Read more >
IIS Express on VS2022 not loading CSS,images and other ...
IIS Express on VS2022 not loading CSS,images and other static content This is happening when I'm trying to access a ".aspx" page in...
Read more >
How to Troubleshoot CSS Not Working - WPForms
Here's a tutorial that'll walk you through all of the main steps to clear your site and plugin caches.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found