Cssnano: Can't disable minification

Created on 2 Aug 2018  路  8Comments  路  Source: cssnano/cssnano

How can I disable minification? I don't need that and have no Idea how to turn it off

Most helpful comment

@selipasha I ran into the same issue. Based on the documentation you have to pass in a preset object in order to be able to override rules:

require('cssnano')({
    preset: ['default', {
        normalizeWhitespace: false
    }]
})

This worked for me; Whitespace is no longer being normalized.

All 8 comments

@selipasha what you mean? Just don't use plugin

I mean I like the other features of this plugin except minification

@selipasha what features?

@selipasha You can disable optimisations by passing options to the preset, as documented here:
https://cssnano.co/guides/presets#excluding-transforms

The optimisations enabled in each preset are listed here:
https://cssnano.co/guides/optimisations

For what reason do you wish to disable the optimisations, if you don't mind me asking? Did you run into a bug?

I can't see any option that disable minification. I have already an extesnion in Visual Studio Code that already minify css files, and I don't need another one. I just need disable cssnano minification in my gulpfile! I see that you barely understand me, so I'm sorry my English isn't the best

I don't understand how to disable this, it's very hard and unclear. Here's a part of my code from my gulpfile, what should I type to disable "normalizeWhitespace" ?

gulp.task('postcss', function () {
    return gulp.src('assets/css/*.css')
        .pipe(postcss([autoprefixer(['last 5 versions']), cssnano(['normalizeWhitespace: false'])]))
        .pipe(gulp.dest('assets/css/'))
})

@selipasha I ran into the same issue. Based on the documentation you have to pass in a preset object in order to be able to override rules:

require('cssnano')({
    preset: ['default', {
        normalizeWhitespace: false
    }]
})

This worked for me; Whitespace is no longer being normalized.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thisconnect picture thisconnect  路  5Comments

bernhardreiter picture bernhardreiter  路  7Comments

daviestar picture daviestar  路  7Comments

maxlapides picture maxlapides  路  7Comments

LastStranger picture LastStranger  路  5Comments