vue-cli-plugin-critical icon indicating copy to clipboard operation
vue-cli-plugin-critical copied to clipboard

Currently not working!

Open anthonygore opened this issue 6 years ago • 7 comments

Not sure what the problem is yet, but it seems that critical CSS is being extracted before the Vue app renders, so you don't get anything from the components. Will investigate.

anthonygore avatar May 18 '18 09:05 anthonygore

Hello ! Do you have some news about this plugin ? Is it still not working ? Thanks !

partikule avatar Aug 23 '18 07:08 partikule

Still not working, sorry. When I have some time I'll try and fix it.

anthonygore avatar Aug 30 '18 09:08 anthonygore

Hello! It worked for me, with some other issues, as in:

  • Setting extract: true didn't really extract from the generated CSS file, everything would be download twice.
  • Using inline: true didn't inline it in the page, instead it added another CSS file to preload, but lastly in the list of all files to be downloaded, so not really that useful.

But the generated CSS was, as a matter of fact, correct and precisely the dimensions I specified.

matheusgrieger avatar Aug 30 '18 23:08 matheusgrieger

Hello ! Means at this state, there is no other solution to put critical css inline than do it manually after extract.

@matheusgrieger : Did you use Webpack 4 for your tests ?

partikule avatar Aug 31 '18 07:08 partikule

@partikule yes, Webpack 4.16.5, to be precise. The project was created using vue create, and there were no changes to the default settings except for .browserlistrc.

What I meant with the previous comment was that, for me, on the opposite of what the issue says, the Vue app is rendered correctly for CSS extraction, just had those two other problems.

matheusgrieger avatar Aug 31 '18 12:08 matheusgrieger

@matheusgrieger How did you setup your vue.config.js ?

We tried on our side and unfortunately, the Vue component rendering wasn't considered.

vue.config.js :

module.exports = {

    pluginOptions: {
        critical: {
            base: __dirname +  '/dist/',
            src: 'index.html',
            dest: 'index.html',
            inline: true,
            width: 1024,
            height: 565,
        }
    },

Our main.js code (extract):

new Vue({
	el: '#app',
	router,
	store,
	components: { App },
	render: h => h(App)
})

webpack version : 4.17.12 vuecli-3: 3.0.1

Any idea ?

Helo3615 avatar Sep 13 '18 14:09 Helo3615

@TuxxyDOS I have used the dimensions property, for multiple resolution extraction, and did not specify any base, src or dest options, if I remember correctly. We have removed it since it would be bad to download twice all that CSS (check my first comment).

matheusgrieger avatar Sep 18 '18 11:09 matheusgrieger