2015-07-12 43 views
0

我正在使用運行OSX 10.10.4的iMac並使用以下工具(以及其他)創建演示網站。在OSX上導致錯誤的Gulp-haml任務10.10.4

HAML v4.0.6, 一飲而盡V3.9, 一飲而盡,HAML v0.1.5

我在index.haml文件下面的代碼片段在我的網站發展的HAML文件夾

/ HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries 
/[if lt IE 9] 
    %script(src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js") 
    %script(src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js") 

當我運行HAML命令在命令行中會產生以下HTML代碼

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
<!--[if lt IE 9]> 
    <script src='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js'></script> 
    <script src='https://oss.maxcdn.com/respond/1.4.2/respond.min.js'></script> 
<![endif]--> 

哪些直接的就是正是我所期望並得到。不過,我有以下的任務在我gulpfile.js設置文件

gulp.task('haml', function() { 
    gulp.src('haml/*.haml') 
     .pipe(haml()) 
     .on('error', errorLog) 
     .pipe(gulp.dest('./')); 
}); 

每當我運行此任務上述HAML片斷中,我獲得了巨大的撞擊聲基本上說,有一個「語法錯誤:意外標識符「,後面跟着一個長長的堆棧跟蹤,進入gulp-haml代碼。

BTW,靠近gulpfile.js文件頂部的錯誤日誌功能很簡單:

function errorLog(error) { 
    console.error.bind(error); 
    this.emit('end'); 
} 

綜合以上HAML碼出來的文件並運行任務無論如何都沒有錯誤創建的HTML文件。

我需要一些幫助。有什麼我做錯了,或者我正在使用的工具設置中有錯誤。

回答

0

我猜你的haml CLI工具是基於Ruby的版本,而不是基於節點的版本(稱爲haml-js)。 Node版本不能正確處理IE條件,其中is a known issue

這工作,但:

/ HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries 
<!--[if lt IE 9]> 
    %script(src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js") 
    %script(src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js") 
<![endif]--> 
+0

謝謝你的提示羅伯特。是的,我的HAML cli是你所假設的Ruby寶石。當我回到項目時,我需要嘗試一下你的建議。歡呼聲 –

+0

現在一切都很好。謝謝羅伯特。 –