Search code examples
compilationgulpmedia-queriesstylus

Some module of a gulp/webpack project sets extra spaces for 0\\0 for @media when compiling stylus


Some module of a gulp/webpack project sets spaces for 0\0 for @media when compiling stylus to css

all and (min-width:0\0) and (min-resolution:.001dpcm)

and here what I get:

@media all and (min-width: 0 \ 0) and (min-resolution: 0.001dpcm) {

0 \ 0 is not working, only 0\0 works! Which module can add those extra spaces? and how to eliminate them? is iy possible yo force it to take the media string the way I write it?

here are some of my project modules:

"eslint-loader": "^1.1.1",
"gulp-combine-mq": "^0.4.0",
"gulp-cssnano": "^2.0.0",
"gulp-filter": "^3.0.1",
"gulp-group-css-media-queries": "^1.1.0",
"gulp-stylint": "^3.0.0",
"gulp-stylus": "^2.1.0",
"merge-stream": "^1.0.0",
"stylint-stylish": "^1.2.0",
"stylus": "^0.54.5",

Solution

  • You can use css literal to prevent stylus transform your rule:

    @css{
      @media all and (min-width:0\0) and (min-resolution:.001dpcm){
        //your css code here
      }
    }
    

    and you get exactly:

     @media all and (min-width:0\0) and (min-resolution:.001dpcm){
       //your css code here
     }
    

    You can also use interpolation:

    @media all and ({"min-width:0\0"}) and (min-resolution:.001dpcm)