2017-08-11 49 views
0

一饮而尽/的WebPack项目的一些模块时,将多余的空格为0 \\ 0 @media设置空间为0 \ 0 @media编译手写笔CSS时一饮而尽/的WebPack项目的一些模块编译笔

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

,在这里我得到什么:

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

0 \ 0不工作,只有0 \ 0作品!哪个模块可以添加这些额外的空间? 以及如何消除它们?是我可能哟迫使它采取媒体字符串我写它的方式?

这里是我的一些项目模块:

"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", 

回答

1

您可以使用css literal防止手写笔改变你的规则:

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

,你会得到准确:

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

你也可以使用插值:

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

谢谢!其实这就是答案。但问题是yt会抛出一个错误:\ node_modules \ css \ lib \ parse \ index.js:72 throw err; ^ 错误:undefined:3693:3:missing'}' ... 我使用combineMq模块,它将相同的@ media合并为一个。看起来像使用@css时会造成崩溃。 – CodeGust

+0

@CodeGust我添加了另一个解决方案,可能适合你 – blonfu

+0

非常感谢你!现在效果很好! – CodeGust