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)
|
||||
end
|
||||
|
||||
desc 'compile HAML', 'Show compile result'
|
||||
def compile(file)
|
||||
print_code generate_code(file)
|
||||
end
|
||||
|
||||
desc 'parse HAML', 'Show parse result'
|
||||
def parse(file)
|
||||
pp generate_ast(file)
|
||||
|
@ -32,6 +37,13 @@ module Hamlit
|
|||
render(args.first.to_s)
|
||||
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.
|
||||
def pp(arg)
|
||||
require 'pry'
|
||||
|
|
Loading…
Add table
Reference in a new issue