vue-meteor icon indicating copy to clipboard operation
vue-meteor copied to clipboard

<style> not minified for production when .vue are in folder "imports/..."

Open green-coder opened this issue 7 years ago • 7 comments

This is a continuation of the issue #156.

I am deploying using mup, with nginx redirecting the only open port 80 to the docker container port 3000.

In the mup.js settings, I set the NODE_ENV variable accordingly, but the problem still exists.

    env: {
      ROOT_URL: 'https://edu.xxxxxx.taipei',
      PORT: 3000,
      MONGO_URL: 'mongodb://localhost/meteor',
      NODE_ENV: 'production',
    },

The CSS in the <style> tags from the .vue files is not showing on the deployed website, I have no clue of what I am supposed to do to make it work.

green-coder avatar May 23 '17 03:05 green-coder

Hi @Akryum, I still have the problem with the CSS in the .vue files not showing up on the client when the port 3003 is not open.

The CSS is also not loaded when I am launching my meteor app using meteor --production. I believe that the problem has nothing to do with mup (which I am not using at the moment), it may be a problem of vue-meteor.

green-coder avatar Jun 05 '17 01:06 green-coder

I tried this, and I could not find the CSS anywhere in the generated bundle:

meteor build ../output --server-only

.. and I finally found the source of the problem !

My .vue components are located in /imports/ui/client/component, they are not minified at all. If I make a .vue component in /client/component, it is minified during the build.

Is it a bug or a feature? (i.e. should I refactor my code to have the components somewhere in the /client/ folder or I should not refactor and wait for a fix in meteor-vue instead?)

green-coder avatar Jun 05 '17 04:06 green-coder

@green-coder Hey, I opened an issue on this yesterday, and didn't notice yours, have you resolved this? I'm getting the same problem during build for production, but I noticed it's only when I have the juliancwirko:postcss package running, if I change it back to standard-css-minifier, it all works fine.. Are you using that package also?

thx

eybarta avatar Jun 19 '17 06:06 eybarta

@eybarta : I didn't solve it. Instead, I avoided the problem by moving all my components outside of the imports directory. I would be happy to bring them back where they should be once this issue is fixed, if it happens one day.

I do use the juliancwirko:postcss Meteor package.

green-coder avatar Jun 19 '17 06:06 green-coder

@green-coder thx appreciate it.. I'll do the same for now.

eybarta avatar Jun 19 '17 07:06 eybarta

Hello,

Did anyone find a solution to minify css/scss from vue components ??

When you are not using the imports folder, all files are globally imported by Meteor. We prefer to use imports(as a black box) to import files in the order we want

mathieustan avatar Jan 03 '20 14:01 mathieustan

Exactly the same issue here. Anyone able to solve the problem?

ArosPrince avatar Dec 18 '21 15:12 ArosPrince