2017-08-11 78 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