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

CSS minification doesn't works if CSS filename pattern contains query string #4124

Open
Vadiok opened this issue Jun 8, 2019 · 3 comments
Open
Labels

Comments

@Vadiok
Copy link

Vadiok commented Jun 8, 2019

Version

3.8.2

Reproduction link

https://github.com/Vadiok/VueCliCssMinificationBug

Environment info

Environment Info:

  System:
    OS: Linux 4.10 Linux Mint 18.3 (Sylvia)
    CPU: (8) x64 Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
  Binaries:
    Node: 10.16.0 - /usr/bin/node
    Yarn: 1.16.0 - /usr/bin/yarn
    npm: 6.9.1-next.0 - /usr/bin/npm
  Browsers:
    Chrome: 75.0.3770.80
    Firefox: 67.0
  npmPackages:
    @vue/cli-overlay:  3.8.0 
    @vue/cli-service: ^3.8.0 => 3.8.0 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    vue: ^2.6.10 => 2.6.10 
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 3.8.2

Steps to reproduce

  • Run "yarn run build"
  • Open "dist/css/app.css"

What is expected?

CSS is minified in production mode

What is actually happening?

CSS isn't compressed


I've created an vue.config.js with custom CSS filename configuration - "css/[name].css?[hash:8]" (see https://github.com/Vadiok/VueCliCssMinificationBug/blob/master/vue.config.js ). Minification doesn't applies when I'm using query string as a filename.

@LinusBorg
Copy link
Member

File names don't have a concept of "query strings", so this is just a strange-looking filee extension. it's not a .css file anymore, it's a .css?ah336ewhaba file - and CSS minifiers only compress .css files.

What exactly are you doing this for?

@Vadiok
Copy link
Author

Vadiok commented Jun 8, 2019

This is for keeping one file on server, but still prevent caching updates by working with Revision Manifest Plugin. I don't like to keep many old css files or clear folder on prod before updating.
The problem is in optimize-cssnano-plugin: https://github.com/intervolga/optimize-cssnano-plugin/blob/master/index.js#L32

@Vadiok
Copy link
Author

Vadiok commented Jun 8, 2019

I've made a pull request to ntervolga/optimize-cssnano-plugin with fix. Waiting for their answer.

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

No branches or pull requests

2 participants