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

Toast css is wiped when using purgecss #1086

Closed
Djiit opened this issue Nov 14, 2018 · 7 comments
Closed

Toast css is wiped when using purgecss #1086

Djiit opened this issue Nov 14, 2018 · 7 comments

Comments

@Djiit
Copy link

Djiit commented Nov 14, 2018

Overview of the problem

Buefy version: 0.7.0
Vuejs version: 2.5.17
OS/Browser: MacOS Mojave / Electron 3.0;

Description

Hi there ! Not sure if it is a bug related to Buefy directly but I didn't encounter it with other libraries.
Please tell me if I can provide you with more info or test case.

Steps to reproduce

Add Buefy to your project.
Add PurgeCSS.
Toasts are no more styled (might the the case of other non-bulma components.

Here is my postcss.config.js:

const tailwindcss = require("tailwindcss");
const purgecss = require("@fullhuman/postcss-purgecss");
const autoprefixer = require("autoprefixer");

class TailwindExtractor {
  static extract(content) {
    return content.match(/[A-z0-9-:\/]+/g) || [];
  }
}

module.exports = {
  plugins: [
    tailwindcss("./src/assets/js/tailwind.js"),
    purgecss({
      content: [
        "./src/**/*.vue",
        "./src/**/*.js",
        "./src/**/*.html",
        "./public/index.html"
      ],
      fontFace: true,
      extractors: [
        {
          extractor: TailwindExtractor,
          extensions: ["html", "js", "vue"]
        }
      ]
    }),
    autoprefixer
  ]
};

Expected behavior

Toasts are still styled like the rest of buefy elements.

Actual behavior

Toasts are displayed without any CSS a the end of the page.

Note: If your wrap the Buefy import between /* purgecss start ignore */ and /* purgecss end ignore */; that's my workaround for now.

@Djiit Djiit changed the title toast css are wiped by purgecss Toast css is wiped when using purgecss Nov 14, 2018
@netname
Copy link

netname commented Nov 18, 2018

I am having the same problem. Also the Select with Fontawesome shows the icon to the right and outside of the Select box
My .postcssrc.js:

const autoprefixer = require("autoprefixer");
const purgecss = require("@fullhuman/postcss-purgecss")

module.exports = {
plugins: [
   autoprefixer( {} ),
   purgecss({
          content: [
            "./src/**/*.html", 
            "./src/**/*.vue"
          ]
    })
 ]
}

@netname
Copy link

netname commented Nov 19, 2018

Purgecss has a guide on how to use it with Vue. https://www.purgecss.com/guides/vue

I just followed the instructions and everything worked!

Edit:
The correct link is: https://github.com/FullHuman/purgecss/tree/master/examples/with-vue/

@jtommy jtommy closed this as completed Nov 19, 2018
@pera
Copy link

pera commented Sep 30, 2019

Note that whitelisting is required since some class names are dynamically constructed, such as navbar-start and navbar-end (by navbar-${positionName}).

@jtommy is support for PurgeCSS something that Buefy could be interested in?

@jtommy
Copy link
Member

jtommy commented Oct 1, 2019

@pera sure, you are welcome!

@jtommy
Copy link
Member

jtommy commented Oct 1, 2019

@pera please open a new issue in order to discuss about it ;)

@pera
Copy link

pera commented Oct 2, 2019

@jtommy Sorry! I just moved my post into this new ticket: #1822

@nkmnz
Copy link

nkmnz commented Oct 29, 2019

hi @Djiit , where do I have to wrap the buefy import?

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

5 participants