gruntjs / grunt-contrib-cssmin

Compress CSS files.
http://gruntjs.com/
MIT License
793 stars 147 forks source link

Styles are being duplicated with >= 2.0.0 #291

Open stefangrund opened 7 years ago

stefangrund commented 7 years ago

We just updated our build process (runs on Node 5) to use grunt-contrib-cssmin 2.2.0 and now we're experiencing that all the styles in our css file are being duplicated in the *.min.css, which is generated with grunt-contrib-cssmin >= 2.0.0.

After we downgraded back to 1.0.2 everything works fine.

Here's our configuration, but I guess that's not the problem. Maybe it's an issue with clean-css?

Any ideas?

pgossmann commented 7 years ago

Any news on this? We faced the exact same issue causing errors in IE which is used by our clients. Thanks for raising the issue here. We downgraded as well and it works fine again.

XhmikosR commented 7 years ago

I need the smallest test case I can reproduce the issue or make sure it's not an issue with clean-css.

Romkond commented 7 years ago

The same issue with 2.2.1.

XhmikosR commented 7 years ago

https://github.com/gruntjs/grunt-contrib-cssmin/issues/291#issuecomment-318296633

Romkond commented 7 years ago

@XhmikosR Ehm... Do you need any settings/examples? Here is the sode:

concat: {
    dist: {},

        critic: {
          files: [{
            nonull: true,
            src: ['public_html/test/www-critical/critical1.css'...,'public_html/test/www-critical/critical17.css',],
            dest: 'public_html/test/css/critical.css'
        }]
        },

    },

critical: {
        test1: {
            options: {
                base: 'public_html',
                css: [
                    'public_html/assets/templates/thesite/css/concat.min.css'
                ],
                width: 1024,
                height: 768
            },
            src: 'public_html/test/www-processed/index.html',
            dest: 'public_html/test/www-critical/critical1.css'
        },

        ...

        test17: {},

cssmin: {
        target: {},

        critic: {
           files: [{
              expand: true,
              cwd: 'public_html/test/css/',
              src: ['critical.css'],
              dest: 'public_html/assets/templates/thesite/css/',
              ext: '.min.css'
            }]
        }
    },

    ...
    'clean',
    'uncss',
    'concat:dist',
    'cssmin:target',
    'fetchpages',
    'processhtml',
    'critical',
    'concat:critic',
    'cssmin:critic',

Here is the result: https://drive.google.com/file/d/0B0hmakB01_IcV1RjY1R6OGJwWE0/view?usp=sharing

XhmikosR commented 7 years ago

I just don't see how cssmin can cause this. Something in your plugins chain is causing it. Try removing critical.

Romkond commented 7 years ago

I can launch it with just grunt cssmin:critic and result will be the same. I've just downgraded to 1.0.2. It's okay now: https://drive.google.com/file/d/0B0hmakB01_IcTDc0Z1NNOWVWZlU/view?usp=sharing Old version used to REMOVE duplicates (there are really there in my source file critical.css). Need my SSH? Let me know then.

XhmikosR commented 7 years ago

I honestly don't see anything that could have caused this from our side.

It's either an upstream issue (or configuration) or something in your workflow.