JSPM

gulp-marko-compile

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q42003F
  • License MIT

Gulp plugin for compiling Marko templates

Package Exports

  • gulp-marko-compile

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gulp-marko-compile) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gulp-marko-compile

npm

Compile Marko templates as part of your Gulp build process.

Usage

var marko = require('gulp-marko-compile');

gulp.task('marko', function() {
  gulp.src('./src/*.marko')
    .pipe(marko({preserveWhitespace: true}).on('error', gutil.log))
    .pipe(gulp.dest('./public/'))
});

Error handling

gulp-marko-compile will emit an error for cases such as invalid Marko syntax. If uncaught, the error will crash gulp.

You will need to attach a listener (i.e. .on('error')) for the error event emitted by gulp-marko-compile:

var markoStream = marko({preserveWhitespace: true});

// Attach listener
markoStream.on('error', function(err) {});

In addition, you may utilize gulp-util's logging function:

var gutil = require('gulp-util');

// ...

var markoStream = marko({preserveWhitespace: true});

// Attach listener
markoStream.on('error', gutil.log);

Since .on(...) returns this, you can make you can compact it as inline code:

gulp.src('./src/*.marko')
  .pipe(marko({preserveWhitespace: true}).on('error', gutil.log))
  // ...

Options

The options object supports the same options as the standard Marko compiler

TODO

Fully comply with Gulp plugin guidelines AKA write some tests

License

MIT License