@LMI

Почему не компилиться Haml через Gulp?

Решил компилировать haml в html через Gulp с помощью плагина gulp-haml , но в результате компиляции в конечном html-файле ошибка
<pre class='error'>SyntaxError: Unexpected identifier
  at Function.&lt;anonymous&gt; (D:\Documents\My frontend\Test\Project\node_modules\haml\lib\haml.js:595:29) и так на 40 строк


В Prepros этот же haml-файл компилируется без проблем.

Таск из gulpfile.js:

gulp.task('hamlCompiling', function () {
  gulp.src('app/page.haml')
    .pipe(haml())
    .pipe(gulp.dest('app/'))
    .pipe(notify('Haml successfully compiled'));
});
  • Вопрос задан
  • 879 просмотров
Решения вопроса 1
aramgreat
@aramgreat
Я занимаюсь front-end разработкой
!!!
%html{lang: "en"}
%head
%meta{charset:"UTF-8"}
%title Document
%meta{content: "IE=edge", http-equiv: "X-UA-Compatible"}
%meta{content: "width=device-width, initial-scale=1", name:"viewport"}
%link{href: "style.min.css", r el "stylesheet"}
%body
Text
Надо в мести => этого : поставить а имя атрибута писать без кавычек и без дваиточие в переди
Ответ написан
Комментировать
Пригласить эксперта
Ответы на вопрос 1
@LMI Автор вопроса
Это haml-файл:

!!!
%html{:lang => "en"}
  %head
    %meta{:charset => "UTF-8"}
    %title Document
    %meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}
    %meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}
    %link{:href => "style.min.css", :rel => "stylesheet"}
  %body
    Text


В выходном html-файле пишет вот такое:

TypeError: undefined is not a function
at eval (eval at (D:\Test\node_modules\haml\lib\haml.js:595:29), :2:15)
at Function. (D:\Test\node_modules\haml\lib\haml.js:595:11)
at execute (D:\Test\node_modules\haml\lib\haml.js:602:8)
at Function.render (D:\Test\node_modules\haml\lib\haml.js:587:12)
at hamlStream (D:\Test\node_modules\gulp-haml\index.js:31:6)
at wrappedMapper (D:\Test\node_modules\map-stream\index.js:84:19)
at Stream.stream.write (D:\Test\node_modules\map-stream\index.js:96:21)
at write (D:\Test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:623:24)
at flow (D:\Test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:632:7)
at DestroyableTransform.pipeOnReadable (D:\Test\node_modules\vinyl-fs\node_modules\readable-stream\lib\_stream_readable.js:664:5)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы