gulp-ruby-haml-format-option

1.0.0 • Public • Published

gulp-ruby-haml-format-option

Compile Haml to HTML with Ruby Haml + option '-q' and '-f NAME'

This is a gulp plugin that will use the haml command line script to compile your Haml files into HTML. You need both Ruby and Haml installed to use this.

Install Ruby

Go to Ruby and install it.

Install haml

If you use Bundler, please follow the below steps in order to install Haml.

echo 'gem "haml"' >> Gemfile
bundle install

Options

This plugin allow to use doubleQuote and format option.

gulpfile.js example

var gulp = require('gulp');
var watch = require('gulp-watch');
var haml = require('gulp-ruby-haml-format-option');
 
// Compile Haml into HTML5
gulp.task('haml', function() {
  gulp.src('./app/assets/haml/**/*.haml', {read: false}).
       pipe(haml()).
       pipe(gulp.dest('./public'));
});
 
// Compile Haml into HTML5 with double quotes around attributes
// Same as haml -q
gulp.task('haml-html5-double-quote', function() {
  var options = {
    doubleQuote: true
  };
  gulp.src('./app/assets/haml/**/*.haml', {read: false}).
       pipe(haml(options)).
       pipe(gulp.dest('./public'));
});
 
// Compile Haml into XHTML with double quotes around attributes
// Same as haml -q -f xhtml
gulp.task('haml-xhtml-double-quote', function() {
  var options = {
    doubleQuote: true,
    format: "xhtml"
  };
  gulp.src('./app/assets/haml/**/*.haml', {read: false}).
       pipe(haml(options)).
       pipe(gulp.dest('./public'));
});
 
// Compile Haml into HTML
// Same as haml -f html
gulp.task('haml-html', function() {
  var options = {
    format: "html"
  };
  gulp.src('./app/assets/haml/**/*.haml', {read: false}).
       pipe(haml(options)).
       pipe(gulp.dest('./public'));
});
 
// Watch for changes in Haml files
gulp.task('haml-watch', function() {
  gulp.src('./app/assets/haml/**/*.haml', {read: false}).
       pipe(watch()).
       pipe(haml()).
       pipe(gulp.dest('./public'));
});

Package Sidebar

Install

npm i gulp-ruby-haml-format-option

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • akinrt