cognitom / gulp-slim

Slim plugin for gulp
https://www.npmjs.org/package/gulp-slim
MIT License
44 stars 14 forks source link

no writecb in Transform class #35

Open viktor-yakubiv opened 9 years ago

viktor-yakubiv commented 9 years ago

I have an issue with compiling slim.

My code looks like this:

var gulp = require('gulp');
var plugins = require('gulp-load-plugins')({scope: ['devDependencies']});

gulp.task('html', function () {
  return gulp.src('slim/**/*.slim')
    .pipe(plugins.slim())
    .pipe(gulp.dest('dist/views'));
});

Error goes here:

[19:07:24] Starting 'html'...
events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: no writecb in Transform class
    at afterTransform (D:\Develop\bootstrap-wdk\node_modules\gulp-slim\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:95:33)
    at TransformState.afterTransform (D:\Develop\bootstrap-wdk\node_modules\gulp-slim\node_modules\through2\node_modules\readable-stream\lib\_stream_transform.js:79:12)
    at Socket.<anonymous> (D:\Develop\bootstrap-wdk\node_modules\gulp-slim\index.js:124:18)
    at emitNone (events.js:72:20)
    at Socket.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

I think this was resolved here, but I don't understand it. https://github.com/sindresorhus/gulp-esnext/issues/8

yozzh commented 9 years ago

Can you show me your slim-file?

viktor-yakubiv commented 9 years ago

It look like this.

<!DOCTYPE html>
html lang="en"
head
  meta charset="UTF-8"/
  title Document
body

I have add some changes and don't remember what it was. There was autogenerated slim code by Emmet (command "!" without braces).

yozzh commented 9 years ago

You have a syntax errors in your slim file:

  1. Slim generates doctype with this construction: doctype html
  2. You have wrong indentation of head and body tags. They must be inside html tag. Try to fix it and reply with results.
viktor-yakubiv commented 9 years ago

No. It is not important. Slim code is valid. Bad indented code will compiles with another nesting only, e.x.:

<!doctype html>
html
head
body

compiles to

<!DOCTYPE html>
<html></html>
<head></head>
<body></body>

I tried to run slimrb * from slim directory and have no errors, good output. When I changes my file, it have no errors, just compile with some unexpectedly.

I have test this task with different code. For example:

doctype html
html lang="en"

This code is valid slim, but causes the same error.

jossiwolf commented 8 years ago

Same issue here, what can I do?

<!doctype html>
html
head
body

This code is working fine.

ekiziltas commented 5 years ago

Same issue