2013-10-23 14 views
1

在我不到文件我已經包含了一些變量,我想欠用於mediaqueries:無法解析mediaqueries以更少的PHP

@mobile:  ~"only screen and (max-width: 529px)"; 
@tablet:  ~"only screen and (min-width: 530px) and (max-width: 949px)"; 
@desktop:  ~"only screen and (min-width: 950px) and (max-width: 1128px)"; 
@desktop-xl: ~"only screen and (min-width: 1129px)"; 

在我的CSS我做這樣的事情,例如:

@media @desktop{ 
    .test{ 
     font-size: 12px; 
    } 
} 

當我嘗試用它編譯預處理器解析它,但是當我LessPHP做,我得到這個錯誤:

PHP Fatal error: Uncaught exception 'Exception' with message 'parse error: failed at `@media @desktop {` 
+3

我在LessPHP 0.4.0在線試過了,它編譯得很好。看到這裏:[goo.gl/swv8rp](http://goo.gl/swv8rp) –

回答

0

如果你把在該文件的頂部的虛擬規則,如:

a {} 

@mobile:  ~"only screen and (max-width: 529px)"; 
@tablet:  ~"only screen and (min-width: 530px) and (max-width: 949px)"; 
@desktop:  ~"only screen and (min-width: 950px) and (max-width: 1128px)"; 
@desktop-xl: ~"only screen and (min-width: 1129px)"; 

@media @desktop{ 
    .test{ 
     font-size: 12px; 
    } 
} 

看來工作,直到問題得到妥善固定。