module Jade
Constants
- VERSION
Public Class Methods
compile(source, options = {})
click to toggle source
# File lib/jade-rails.rb, line 9 def compile(source, options = {}) source = source.read if source.respond_to?(:read) # Command line arguments take precedence over json options in Jade binary # @link https://github.com/jadejs/jade/blob/master/bin/jade.js cmd = %w(jade --client) cmd.push('--path', options[:filename]) if options[:filename] cmd.push('--pretty') if options[:pretty] cmd.push('--no-debug') unless options[:debug] cmd.push('--obj', JSON.generate(options)) stdout, stderr, exit_status = Open3.capture3(*cmd, stdin_data: source) unless exit_status.success? raise CompileError.new(stderr) end stdout end