mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Add compile subcommand
This commit is contained in:
parent
fcb3308724
commit
0361d407a8
1 changed files with 12 additions and 0 deletions
|
@ -9,6 +9,11 @@ module Hamlit
|
||||||
puts eval(code)
|
puts eval(code)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'compile HAML', 'Show compile result'
|
||||||
|
def compile(file)
|
||||||
|
print_code generate_code(file)
|
||||||
|
end
|
||||||
|
|
||||||
desc 'parse HAML', 'Show parse result'
|
desc 'parse HAML', 'Show parse result'
|
||||||
def parse(file)
|
def parse(file)
|
||||||
pp generate_ast(file)
|
pp generate_ast(file)
|
||||||
|
@ -32,6 +37,13 @@ module Hamlit
|
||||||
render(args.first.to_s)
|
render(args.first.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def print_code(code)
|
||||||
|
require 'pry'
|
||||||
|
puts Pry.Code(code).highlighted
|
||||||
|
rescue LoadError
|
||||||
|
puts code
|
||||||
|
end
|
||||||
|
|
||||||
# Enable colored pretty printing only for development environment.
|
# Enable colored pretty printing only for development environment.
|
||||||
def pp(arg)
|
def pp(arg)
|
||||||
require 'pry'
|
require 'pry'
|
||||||
|
|
Loading…
Add table
Reference in a new issue