[Command Line] Access the Sass Repl (sass -i) with the compass environment loaded.
This commit is contained in:
parent
22cdcf2cb5
commit
46ccb5b6e1
@ -6,6 +6,6 @@ require 'compass/commands/registry'
|
|||||||
%w(base generate_grid_background help list_frameworks project_base
|
%w(base generate_grid_background help list_frameworks project_base
|
||||||
update_project watch_project create_project installer_command
|
update_project watch_project create_project installer_command
|
||||||
print_version project_stats stamp_pattern validate_project
|
print_version project_stats stamp_pattern validate_project
|
||||||
write_configuration).each do |lib|
|
write_configuration interactive).each do |lib|
|
||||||
require "compass/commands/#{lib}"
|
require "compass/commands/#{lib}"
|
||||||
end
|
end
|
||||||
|
61
lib/compass/commands/interactive.rb
Normal file
61
lib/compass/commands/interactive.rb
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
|
||||||
|
require 'compass/commands/project_base'
|
||||||
|
require 'compass/commands/update_project'
|
||||||
|
|
||||||
|
module Compass
|
||||||
|
module Commands
|
||||||
|
module InteractiveOptionsParser
|
||||||
|
def set_options(opts)
|
||||||
|
opts.banner = %Q{
|
||||||
|
Usage: compass interactive [path/to/project] [options]
|
||||||
|
|
||||||
|
Description:
|
||||||
|
Interactively evaluate SassScript
|
||||||
|
|
||||||
|
Options:
|
||||||
|
}.strip.split("\n").map{|l| l.gsub(/^ {0,10}/,'')}.join("\n")
|
||||||
|
|
||||||
|
super
|
||||||
|
end
|
||||||
|
end
|
||||||
|
class Interactive < ProjectBase
|
||||||
|
|
||||||
|
register :interactive
|
||||||
|
|
||||||
|
def initialize(working_path, options)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
|
||||||
|
def perform
|
||||||
|
require 'sass/repl'
|
||||||
|
Sass::Repl.new.run
|
||||||
|
end
|
||||||
|
|
||||||
|
class << self
|
||||||
|
|
||||||
|
def option_parser(arguments)
|
||||||
|
parser = Compass::Exec::CommandOptionParser.new(arguments)
|
||||||
|
parser.extend(Compass::Exec::GlobalOptionsParser)
|
||||||
|
parser.extend(Compass::Exec::ProjectOptionsParser)
|
||||||
|
parser.extend(InteractiveOptionsParser)
|
||||||
|
end
|
||||||
|
|
||||||
|
def usage
|
||||||
|
option_parser([]).to_s
|
||||||
|
end
|
||||||
|
|
||||||
|
def description(command)
|
||||||
|
"Interactively evaluate SassScript"
|
||||||
|
end
|
||||||
|
|
||||||
|
def parse!(arguments)
|
||||||
|
parser = option_parser(arguments)
|
||||||
|
parser.parse!
|
||||||
|
parser.options
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user