Skip to content
This repository was archived by the owner on Dec 19, 2024. It is now read-only.
This repository was archived by the owner on Dec 19, 2024. It is now read-only.

Compress option not working in CLI - possible conflict with other options #195

@dhruvbhatia

Description

@dhruvbhatia

Using the -c flag within the CLI does not actually compress a given input file under v1.8.3.

E.g. let's consider the compression example on the cssnano homepage:

input.css

h1::before, h1:before {
    margin: 10px 20px 10px 20px;
    color: #ff0000;
    -webkit-border-radius: 16px;
    border-radius: 16px;
    font-weight: normal;
    font-weight: normal;
}
/* invalid placement */
@charset "utf-8";

We'd expect cssnext -c input.css to give us this:

@charset "utf-8";h1:before{margin:10px 20px;color:red;border-radius:1pc;font-weight:400}

However we just get back the original input.css (non-compressed).

After some digging I found that adding the following flags in addition to -c seems to help, so I imagine there's a conflict with how cssnano is being called:

Hacky workaround - disable everything but compression:
> cssnext -c input.css --no-custom-properties --no-calc --no-custom-media --no-media-queries-range --no-custom-selectors --no-color-rebeccapurple --no-color-hwb --no-color-gray --no-color-hex-alpha --no-color-function --no-font-variant --no-filter --no-rem --no-pseudo-elements --no-pseudo-class-matches --no-pseudo-class-not --no-pseudo-class-any-link --no-color-rgba --no-autoprefixer

The above delivers compressed output, but it obviously isn't ideal given we're effectively disabling all the other features within cssnext.

Has anyone run into the same issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions