4

I am extremely puzzled...this is my 2nd vue.js project. It's giving me massive issues when I push the site live.

The app works locally without any issue, but after pushing to netlify and building the CSS doesnt seem to work. I am using purgecss this is my postcss.config.js file:

const IN_PRODUCTION = process.env.NODE_ENV === 'production';

module.exports = {
    plugins: [
        require('tailwindcss')('tailwind.js'),
        require('autoprefixer')(),
        IN_PRODUCTION &&
            require('@fullhuman/postcss-purgecss')({
                content: ['./public/**/*.html', './src/**/*.vue'],
                defaultExtractor(content) {
                    const contentWithoutStyleBlocks = content.replace(
                        /<style[^]+?<\/style>/gi,
                        ''
                    );
                    return (
                        contentWithoutStyleBlocks.match(
                            /[A-Za-z0-9-_/:]*[A-Za-z0-9-_/]+/g
                        ) || []
                    );
                },
                whitelist: [],
                whitelistPatterns: [
                    /-(leave|enter|appear)(|-(to|from|active))$/,
                    /^(?!(|.*?:)cursor-move).+-move$/,
                    /^router-link(|-exact)-active$/,
                    /data-v-.*/,
                ],
            }),
    ],
};

As per the TW and PurgeCSS instructions. This again works locally...but not in prod.

Netlify build command is npm run build and it's served from the dist folder.

You can see the app here: https://beautify-urls.netlify.app/ And repo here: https://github.com/mrpbennett/beautify-url

I am not using scoped on my style tags

any ideas would be much appericated.

1 Answer 1

2

You need to change the Publish directory field from dist to /dist.

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

Hmm I havent done this before. Also the netlify instructions state I should just use dist
It would be really great if you can please have a look at this question and provide some work-around? stackoverflow.com/q/72198087/7584240 Thanks a lot in advance.
In the instructions here -> netlify.com/blog/2019/11/30/how-to-deploy-a-vue-site we have "use the build command npm run build or yarn build. Set the publish directory to dist." I've tried dist /dist and dist/ to no hope.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.