L
L
LMI2015-12-27 23:02:05
Node.js
LMI, 2015-12-27 23:02:05

Why not compile Haml with Gulp?

I decided to compile haml to html through Gulp using the gulp-haml plugin, but as a result of compilation in the final html file, an error

<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 строк

In Prepros, the same haml file compiles without problems.
Task from gulpfile.js:
gulp.task('hamlCompiling', function () {
  gulp.src('app/page.haml')
    .pipe(haml())
    .pipe(gulp.dest('app/'))
    .pipe(notify('Haml successfully compiled'));
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aram Muradyan, 2016-06-08
@LMI

!!!
%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
Must be in revenge => this : put and write the name of the attribute without quotes and without two dots in front

L
LMI, 2015-12-28
@LMI

This is the haml file:

!!!
%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

In the output html file, it writes like this:
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) stream\lib\_stream_readable.js:664:5)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question