Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

doesn't work with VUE #35

Open
DJAlejandro opened this issue Jul 6, 2019 · 1 comment
Open

doesn't work with VUE #35

DJAlejandro opened this issue Jul 6, 2019 · 1 comment

Comments

@DJAlejandro
Copy link

DJAlejandro commented Jul 6, 2019

I want CSS tree shaking.
Without using VUE it works well by using purgecss-webpack-plugin.

But i want VUE supporting CSS tree shaking,so I choose postcss-purgecss.But STILL DON'T WORK

here is my postcss.config.js

const path = require("path");

module.exports = {
    plugins: [
        require("@fullhuman/postcss-purgecss")({
            content: [
                path.join(__dirname, './src/views/*.vue'),
            ],
        }),
       ....
    ]
};
@saulhardman
Copy link

Hi @DJAlejandro, for more information about configuring PostCSS PurgeCSS to work with Vue single file components, take a look at this blog post.

The article is about Nuxt specifically, but it applies to Vue in general. The issue is that PurgeCSS default extractors detect and preserve all styles defined in the <style> block. Excluding those blocks from selector extraction should achieve the outcome you're looking for.

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

No branches or pull requests

2 participants