haml 3.1.0.alpha.14 → 3.1.0.alpha.17
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of haml might be problematic. Click here for more details.
- data/EDGE_GEM_VERSION +1 -1
- data/VERSION +1 -1
- data/lib/haml.rb +3 -2
- data/lib/haml/exec.rb +0 -226
- data/lib/sass.rb +8 -0
- data/lib/sass/plugin.rb +8 -0
- data/lib/sass/rails2_shim.rb +9 -0
- data/lib/sass/rails3_shim.rb +16 -0
- data/vendor/sass/CONTRIBUTING +3 -0
- data/vendor/sass/MIT-LICENSE +20 -0
- data/vendor/sass/README.md +201 -0
- data/vendor/sass/Rakefile +363 -0
- data/vendor/sass/TODO +39 -0
- data/vendor/sass/VERSION +1 -0
- data/vendor/sass/VERSION_NAME +1 -0
- data/vendor/sass/bin/css2sass +13 -0
- data/vendor/sass/bin/sass +8 -0
- data/vendor/sass/bin/sass-convert +7 -0
- data/vendor/sass/doc-src/FAQ.md +35 -0
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +210 -0
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +1878 -0
- data/vendor/sass/doc-src/SASS_REFERENCE.md +1713 -0
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +155 -0
- data/vendor/sass/ext/extconf.rb +10 -0
- data/vendor/sass/extra/update_watch.rb +13 -0
- data/vendor/sass/init.rb +18 -0
- data/vendor/sass/lib/sass.rb +71 -0
- data/vendor/sass/lib/sass/cache_store.rb +208 -0
- data/vendor/sass/lib/sass/callbacks.rb +66 -0
- data/vendor/sass/lib/sass/css.rb +294 -0
- data/vendor/sass/lib/sass/engine.rb +792 -0
- data/vendor/sass/lib/sass/environment.rb +143 -0
- data/vendor/sass/lib/sass/error.rb +201 -0
- data/vendor/sass/lib/sass/exec.rb +619 -0
- data/vendor/sass/lib/sass/importers.rb +22 -0
- data/vendor/sass/lib/sass/importers/base.rb +138 -0
- data/vendor/sass/lib/sass/importers/filesystem.rb +121 -0
- data/vendor/sass/lib/sass/less.rb +363 -0
- data/vendor/sass/lib/sass/plugin.rb +126 -0
- data/vendor/sass/lib/sass/plugin/compiler.rb +346 -0
- data/vendor/sass/lib/sass/plugin/configuration.rb +123 -0
- data/vendor/sass/lib/sass/plugin/generic.rb +15 -0
- data/vendor/sass/lib/sass/plugin/merb.rb +48 -0
- data/vendor/sass/lib/sass/plugin/rack.rb +47 -0
- data/vendor/sass/lib/sass/plugin/rails.rb +41 -0
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +145 -0
- data/vendor/sass/lib/sass/railtie.rb +8 -0
- data/vendor/sass/lib/sass/repl.rb +58 -0
- data/vendor/sass/lib/sass/root.rb +7 -0
- data/vendor/sass/lib/sass/script.rb +63 -0
- data/vendor/sass/lib/sass/script/bool.rb +18 -0
- data/vendor/sass/lib/sass/script/color.rb +491 -0
- data/vendor/sass/lib/sass/script/css_lexer.rb +29 -0
- data/vendor/sass/lib/sass/script/css_parser.rb +31 -0
- data/vendor/sass/lib/sass/script/funcall.rb +76 -0
- data/vendor/sass/lib/sass/script/functions.rb +852 -0
- data/vendor/sass/lib/sass/script/interpolation.rb +70 -0
- data/vendor/sass/lib/sass/script/lexer.rb +337 -0
- data/vendor/sass/lib/sass/script/literal.rb +236 -0
- data/vendor/sass/lib/sass/script/node.rb +112 -0
- data/vendor/sass/lib/sass/script/number.rb +423 -0
- data/vendor/sass/lib/sass/script/operation.rb +90 -0
- data/vendor/sass/lib/sass/script/parser.rb +392 -0
- data/vendor/sass/lib/sass/script/string.rb +67 -0
- data/vendor/sass/lib/sass/script/string_interpolation.rb +93 -0
- data/vendor/sass/lib/sass/script/unary_operation.rb +57 -0
- data/vendor/sass/lib/sass/script/variable.rb +48 -0
- data/vendor/sass/lib/sass/scss.rb +17 -0
- data/vendor/sass/lib/sass/scss/css_parser.rb +51 -0
- data/vendor/sass/lib/sass/scss/parser.rb +838 -0
- data/vendor/sass/lib/sass/scss/rx.rb +126 -0
- data/vendor/sass/lib/sass/scss/sass_parser.rb +11 -0
- data/vendor/sass/lib/sass/scss/script_lexer.rb +15 -0
- data/vendor/sass/lib/sass/scss/script_parser.rb +25 -0
- data/vendor/sass/lib/sass/scss/static_parser.rb +40 -0
- data/vendor/sass/lib/sass/selector.rb +361 -0
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +62 -0
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +82 -0
- data/vendor/sass/lib/sass/selector/sequence.rb +236 -0
- data/vendor/sass/lib/sass/selector/simple.rb +113 -0
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +135 -0
- data/vendor/sass/lib/sass/shared.rb +78 -0
- data/vendor/sass/lib/sass/tree/comment_node.rb +128 -0
- data/vendor/sass/lib/sass/tree/debug_node.rb +36 -0
- data/vendor/sass/lib/sass/tree/directive_node.rb +75 -0
- data/vendor/sass/lib/sass/tree/extend_node.rb +65 -0
- data/vendor/sass/lib/sass/tree/for_node.rb +67 -0
- data/vendor/sass/lib/sass/tree/if_node.rb +81 -0
- data/vendor/sass/lib/sass/tree/import_node.rb +124 -0
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +60 -0
- data/vendor/sass/lib/sass/tree/mixin_node.rb +123 -0
- data/vendor/sass/lib/sass/tree/node.rb +490 -0
- data/vendor/sass/lib/sass/tree/prop_node.rb +220 -0
- data/vendor/sass/lib/sass/tree/root_node.rb +125 -0
- data/vendor/sass/lib/sass/tree/rule_node.rb +273 -0
- data/vendor/sass/lib/sass/tree/variable_node.rb +39 -0
- data/vendor/sass/lib/sass/tree/warn_node.rb +42 -0
- data/vendor/sass/lib/sass/tree/while_node.rb +48 -0
- data/vendor/sass/lib/sass/util.rb +700 -0
- data/vendor/sass/lib/sass/util/subset_map.rb +101 -0
- data/vendor/sass/lib/sass/version.rb +109 -0
- data/vendor/sass/rails/init.rb +1 -0
- data/vendor/sass/sass.gemspec +32 -0
- data/vendor/sass/test/sass/cache_test.rb +74 -0
- data/vendor/sass/test/sass/callbacks_test.rb +61 -0
- data/vendor/sass/test/sass/conversion_test.rb +1210 -0
- data/vendor/sass/test/sass/css2sass_test.rb +364 -0
- data/vendor/sass/test/sass/data/hsl-rgb.txt +319 -0
- data/vendor/sass/test/sass/engine_test.rb +2305 -0
- data/vendor/sass/test/sass/extend_test.rb +1348 -0
- data/vendor/sass/test/sass/functions_test.rb +565 -0
- data/vendor/sass/test/sass/importer_test.rb +104 -0
- data/vendor/sass/test/sass/less_conversion_test.rb +632 -0
- data/vendor/sass/test/sass/mock_importer.rb +49 -0
- data/vendor/sass/test/sass/more_results/more1.css +9 -0
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/vendor/sass/test/sass/more_results/more_import.css +29 -0
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +2 -0
- data/vendor/sass/test/sass/more_templates/more1.sass +23 -0
- data/vendor/sass/test/sass/more_templates/more_import.sass +11 -0
- data/vendor/sass/test/sass/plugin_test.rb +430 -0
- data/vendor/sass/test/sass/results/alt.css +4 -0
- data/vendor/sass/test/sass/results/basic.css +9 -0
- data/vendor/sass/test/sass/results/compact.css +5 -0
- data/vendor/sass/test/sass/results/complex.css +86 -0
- data/vendor/sass/test/sass/results/compressed.css +1 -0
- data/vendor/sass/test/sass/results/expanded.css +19 -0
- data/vendor/sass/test/sass/results/import.css +31 -0
- data/vendor/sass/test/sass/results/line_numbers.css +49 -0
- data/vendor/sass/test/sass/results/mixins.css +95 -0
- data/vendor/sass/test/sass/results/multiline.css +24 -0
- data/vendor/sass/test/sass/results/nested.css +22 -0
- data/vendor/sass/test/sass/results/options.css +1 -0
- data/vendor/sass/test/sass/results/parent_ref.css +13 -0
- data/vendor/sass/test/sass/results/script.css +16 -0
- data/vendor/sass/test/sass/results/scss_import.css +31 -0
- data/vendor/sass/test/sass/results/scss_importee.css +2 -0
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/vendor/sass/test/sass/results/subdir/subdir.css +3 -0
- data/vendor/sass/test/sass/results/units.css +11 -0
- data/vendor/sass/test/sass/results/warn.css +0 -0
- data/vendor/sass/test/sass/results/warn_imported.css +0 -0
- data/vendor/sass/test/sass/script_conversion_test.rb +254 -0
- data/vendor/sass/test/sass/script_test.rb +470 -0
- data/vendor/sass/test/sass/scss/css_test.rb +897 -0
- data/vendor/sass/test/sass/scss/rx_test.rb +156 -0
- data/vendor/sass/test/sass/scss/scss_test.rb +1088 -0
- data/vendor/sass/test/sass/scss/test_helper.rb +37 -0
- data/vendor/sass/test/sass/templates/_partial.sass +2 -0
- data/vendor/sass/test/sass/templates/alt.sass +16 -0
- data/vendor/sass/test/sass/templates/basic.sass +23 -0
- data/vendor/sass/test/sass/templates/bork1.sass +2 -0
- data/vendor/sass/test/sass/templates/bork2.sass +2 -0
- data/vendor/sass/test/sass/templates/bork3.sass +2 -0
- data/vendor/sass/test/sass/templates/bork4.sass +2 -0
- data/vendor/sass/test/sass/templates/compact.sass +17 -0
- data/vendor/sass/test/sass/templates/complex.sass +305 -0
- data/vendor/sass/test/sass/templates/compressed.sass +15 -0
- data/vendor/sass/test/sass/templates/expanded.sass +17 -0
- data/vendor/sass/test/sass/templates/import.sass +12 -0
- data/vendor/sass/test/sass/templates/importee.less +2 -0
- data/vendor/sass/test/sass/templates/importee.sass +19 -0
- data/vendor/sass/test/sass/templates/line_numbers.sass +13 -0
- data/vendor/sass/test/sass/templates/mixin_bork.sass +5 -0
- data/vendor/sass/test/sass/templates/mixins.sass +76 -0
- data/vendor/sass/test/sass/templates/multiline.sass +20 -0
- data/vendor/sass/test/sass/templates/nested.sass +25 -0
- data/vendor/sass/test/sass/templates/nested_bork1.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork2.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork3.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_bork4.sass +2 -0
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +6 -0
- data/vendor/sass/test/sass/templates/options.sass +2 -0
- data/vendor/sass/test/sass/templates/parent_ref.sass +25 -0
- data/vendor/sass/test/sass/templates/script.sass +101 -0
- data/vendor/sass/test/sass/templates/scss_import.scss +11 -0
- data/vendor/sass/test/sass/templates/scss_importee.scss +1 -0
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +6 -0
- data/vendor/sass/test/sass/templates/units.sass +11 -0
- data/vendor/sass/test/sass/templates/warn.sass +3 -0
- data/vendor/sass/test/sass/templates/warn_imported.sass +4 -0
- data/vendor/sass/test/sass/test_helper.rb +8 -0
- data/vendor/sass/test/sass/util/subset_map_test.rb +91 -0
- data/vendor/sass/test/sass/util_test.rb +275 -0
- data/vendor/sass/test/test_helper.rb +64 -0
- data/vendor/sass/vendor/fssm/LICENSE +20 -0
- data/vendor/sass/vendor/fssm/README.markdown +55 -0
- data/vendor/sass/vendor/fssm/Rakefile +59 -0
- data/vendor/sass/vendor/fssm/VERSION.yml +5 -0
- data/vendor/sass/vendor/fssm/example.rb +9 -0
- data/vendor/sass/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/sass/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/sass/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +75 -0
- data/vendor/sass/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/sass/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/sass/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/sass/vendor/fssm/spec/spec_helper.rb +14 -0
- data/vendor/sass/yard/callbacks.rb +29 -0
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +26 -0
- data/vendor/sass/yard/default/layout/html/footer.erb +12 -0
- data/vendor/sass/yard/inherited_hash.rb +41 -0
- metadata +219 -2
data/EDGE_GEM_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.17
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.0.alpha.
|
1
|
+
3.1.0.alpha.17
|
data/lib/haml.rb
CHANGED
@@ -25,9 +25,10 @@ module Haml
|
|
25
25
|
# This isn't actually used;
|
26
26
|
# it's just passed in in case it needs to be used in the future
|
27
27
|
def self.init_rails(binding)
|
28
|
-
#
|
28
|
+
# 2.2 <= Rails < 3
|
29
29
|
if defined?(Rails) && Rails.respond_to?(:configuration) &&
|
30
|
-
Rails.configuration.respond_to?(:after_initialize)
|
30
|
+
Rails.configuration.respond_to?(:after_initialize) &&
|
31
|
+
!Haml::Util.ap_geq_3?
|
31
32
|
Rails.configuration.after_initialize do
|
32
33
|
next if defined?(Sass)
|
33
34
|
autoload(:Sass, 'sass/rails2_shim')
|
data/lib/haml/exec.rb
CHANGED
@@ -344,231 +344,5 @@ END
|
|
344
344
|
handle_load_error(err)
|
345
345
|
end
|
346
346
|
end
|
347
|
-
<<<<<<< HEAD
|
348
|
-
=======
|
349
|
-
|
350
|
-
# The `sass-convert` executable.
|
351
|
-
class SassConvert < Generic
|
352
|
-
# @param args [Array<String>] The command-line arguments
|
353
|
-
def initialize(args)
|
354
|
-
super
|
355
|
-
require 'sass'
|
356
|
-
@options[:for_tree] = {}
|
357
|
-
@options[:for_engine] = {:cache => false, :read_cache => true}
|
358
|
-
end
|
359
|
-
|
360
|
-
# Tells optparse how to parse the arguments.
|
361
|
-
#
|
362
|
-
# @param opts [OptionParser]
|
363
|
-
def set_opts(opts)
|
364
|
-
opts.banner = <<END
|
365
|
-
Usage: sass-convert [options] [INPUT] [OUTPUT]
|
366
|
-
|
367
|
-
Description:
|
368
|
-
Converts between CSS, Sass, and SCSS files.
|
369
|
-
E.g. converts from SCSS to Sass,
|
370
|
-
or converts from CSS to SCSS (adding appropriate nesting).
|
371
|
-
|
372
|
-
Options:
|
373
|
-
END
|
374
|
-
|
375
|
-
opts.on('-F', '--from FORMAT',
|
376
|
-
'The format to convert from. Can be css, scss, sass, less, or sass2.',
|
377
|
-
'sass2 is the same as sass, but updates more old syntax to new.',
|
378
|
-
'By default, this is inferred from the input filename.',
|
379
|
-
'If there is none, defaults to css.') do |name|
|
380
|
-
@options[:from] = name.downcase.to_sym
|
381
|
-
unless [:css, :scss, :sass, :less, :sass2].include?(@options[:from])
|
382
|
-
raise "Unknown format for sass-convert --from: #{name}"
|
383
|
-
end
|
384
|
-
try_less_note if @options[:from] == :less
|
385
|
-
end
|
386
|
-
|
387
|
-
opts.on('-T', '--to FORMAT',
|
388
|
-
'The format to convert to. Can be scss or sass.',
|
389
|
-
'By default, this is inferred from the output filename.',
|
390
|
-
'If there is none, defaults to sass.') do |name|
|
391
|
-
@options[:to] = name.downcase.to_sym
|
392
|
-
unless [:scss, :sass].include?(@options[:to])
|
393
|
-
raise "Unknown format for sass-convert --to: #{name}"
|
394
|
-
end
|
395
|
-
end
|
396
|
-
|
397
|
-
opts.on('-R', '--recursive',
|
398
|
-
'Convert all the files in a directory. Requires --from and --to.') do
|
399
|
-
@options[:recursive] = true
|
400
|
-
end
|
401
|
-
|
402
|
-
opts.on('-i', '--in-place',
|
403
|
-
'Convert a file to its own syntax.',
|
404
|
-
'This can be used to update some deprecated syntax.') do
|
405
|
-
@options[:in_place] = true
|
406
|
-
end
|
407
|
-
|
408
|
-
opts.on('--dasherize', 'Convert underscores to dashes') do
|
409
|
-
@options[:for_tree][:dasherize] = true
|
410
|
-
end
|
411
|
-
|
412
|
-
opts.on('--old', 'Output the old-style ":prop val" property syntax.',
|
413
|
-
'Only meaningful when generating Sass.') do
|
414
|
-
@options[:for_tree][:old] = true
|
415
|
-
end
|
416
|
-
|
417
|
-
opts.on('-C', '--no-cache', "Don't cache to sassc files.") do
|
418
|
-
@options[:for_engine][:read_cache] = false
|
419
|
-
end
|
420
|
-
|
421
|
-
unless ::Haml::Util.ruby1_8?
|
422
|
-
opts.on('-E encoding', 'Specify the default encoding for Sass and CSS files.') do |encoding|
|
423
|
-
Encoding.default_external = encoding
|
424
|
-
end
|
425
|
-
end
|
426
|
-
|
427
|
-
super
|
428
|
-
end
|
429
|
-
|
430
|
-
# Processes the options set by the command-line arguments,
|
431
|
-
# and runs the CSS compiler appropriately.
|
432
|
-
def process_result
|
433
|
-
require 'sass'
|
434
|
-
|
435
|
-
if @options[:recursive]
|
436
|
-
process_directory
|
437
|
-
return
|
438
|
-
end
|
439
|
-
|
440
|
-
super
|
441
|
-
input = @options[:input]
|
442
|
-
raise "Error: '#{input.path}' is a directory (did you mean to use --recursive?)" if File.directory?(input)
|
443
|
-
output = @options[:output]
|
444
|
-
output = input if @options[:in_place]
|
445
|
-
process_file(input, output)
|
446
|
-
end
|
447
|
-
|
448
|
-
private
|
449
|
-
|
450
|
-
def process_directory
|
451
|
-
unless input = @options[:input] = @args.shift
|
452
|
-
raise "Error: directory required when using --recursive."
|
453
|
-
end
|
454
|
-
|
455
|
-
output = @options[:output] = @args.shift
|
456
|
-
raise "Error: --from required when using --recursive." unless @options[:from]
|
457
|
-
raise "Error: --to required when using --recursive." unless @options[:to]
|
458
|
-
raise "Error: '#{@options[:input]}' is not a directory" unless File.directory?(@options[:input])
|
459
|
-
if @options[:output] && File.exists?(@options[:output]) && !File.directory?(@options[:output])
|
460
|
-
raise "Error: '#{@options[:output]}' is not a directory"
|
461
|
-
end
|
462
|
-
@options[:output] ||= @options[:input]
|
463
|
-
|
464
|
-
from = @options[:from]
|
465
|
-
from = :sass if from == :sass2
|
466
|
-
if @options[:to] == @options[:from] && !@options[:in_place]
|
467
|
-
fmt = @options[:from]
|
468
|
-
raise "Error: converting from #{fmt} to #{fmt} without --in-place"
|
469
|
-
end
|
470
|
-
|
471
|
-
ext = @options[:from]
|
472
|
-
ext = :sass if ext == :sass2
|
473
|
-
Dir.glob("#{@options[:input]}/**/*.#{ext}") do |f|
|
474
|
-
output =
|
475
|
-
if @options[:in_place]
|
476
|
-
f
|
477
|
-
elsif @options[:output]
|
478
|
-
output_name = f.gsub(/\.(c|sa|sc|le)ss$/, ".#{@options[:to]}")
|
479
|
-
output_name[0...@options[:input].size] = @options[:output]
|
480
|
-
output_name
|
481
|
-
else
|
482
|
-
f.gsub(/\.(c|sa|sc|le)ss$/, ".#{@options[:to]}")
|
483
|
-
end
|
484
|
-
|
485
|
-
unless File.directory?(File.dirname(output))
|
486
|
-
puts_action :directory, :green, File.dirname(output)
|
487
|
-
FileUtils.mkdir_p(File.dirname(output))
|
488
|
-
end
|
489
|
-
puts_action :convert, :green, f
|
490
|
-
if File.exists?(output)
|
491
|
-
puts_action :overwrite, :yellow, output
|
492
|
-
else
|
493
|
-
puts_action :create, :green, output
|
494
|
-
end
|
495
|
-
|
496
|
-
input = open_file(f)
|
497
|
-
output = @options[:in_place] ? input : open_file(output, "w")
|
498
|
-
process_file(input, output)
|
499
|
-
end
|
500
|
-
end
|
501
|
-
|
502
|
-
def process_file(input, output)
|
503
|
-
if input.is_a?(File)
|
504
|
-
@options[:from] ||=
|
505
|
-
case input.path
|
506
|
-
when /\.scss$/; :scss
|
507
|
-
when /\.sass$/; :sass
|
508
|
-
when /\.less$/; :less
|
509
|
-
when /\.css$/; :css
|
510
|
-
end
|
511
|
-
elsif @options[:in_place]
|
512
|
-
raise "Error: the --in-place option requires a filename."
|
513
|
-
end
|
514
|
-
|
515
|
-
if output.is_a?(File)
|
516
|
-
@options[:to] ||=
|
517
|
-
case output.path
|
518
|
-
when /\.scss$/; :scss
|
519
|
-
when /\.sass$/; :sass
|
520
|
-
end
|
521
|
-
end
|
522
|
-
|
523
|
-
if @options[:from] == :sass2
|
524
|
-
@options[:from] = :sass
|
525
|
-
@options[:for_engine][:sass2] = true
|
526
|
-
end
|
527
|
-
|
528
|
-
@options[:from] ||= :css
|
529
|
-
@options[:to] ||= :sass
|
530
|
-
@options[:for_engine][:syntax] = @options[:from]
|
531
|
-
|
532
|
-
out =
|
533
|
-
::Haml::Util.silence_haml_warnings do
|
534
|
-
if @options[:from] == :css
|
535
|
-
require 'sass/css'
|
536
|
-
::Sass::CSS.new(input.read, @options[:for_tree]).render(@options[:to])
|
537
|
-
elsif @options[:from] == :less
|
538
|
-
require 'sass/less'
|
539
|
-
try_less_note
|
540
|
-
input = input.read if input.is_a?(IO) && !input.is_a?(File) # Less is dumb
|
541
|
-
Less::Engine.new(input).to_tree.to_sass_tree.send("to_#{@options[:to]}", @options[:for_tree])
|
542
|
-
else
|
543
|
-
if input.is_a?(File)
|
544
|
-
::Sass::Engine.for_file(input.path, @options[:for_engine])
|
545
|
-
else
|
546
|
-
::Sass::Engine.new(input.read, @options[:for_engine])
|
547
|
-
end.to_tree.send("to_#{@options[:to]}", @options[:for_tree])
|
548
|
-
end
|
549
|
-
end
|
550
|
-
|
551
|
-
output = File.open(input.path, 'w') if @options[:in_place]
|
552
|
-
output.write(out)
|
553
|
-
rescue ::Sass::SyntaxError => e
|
554
|
-
raise e if @options[:trace]
|
555
|
-
file = " of #{e.sass_filename}" if e.sass_filename
|
556
|
-
raise "Error on line #{e.sass_line}#{file}: #{e.message}\n Use --trace for backtrace"
|
557
|
-
rescue LoadError => err
|
558
|
-
handle_load_error(err)
|
559
|
-
end
|
560
|
-
|
561
|
-
@@less_note_printed = false
|
562
|
-
def try_less_note
|
563
|
-
return if @@less_note_printed
|
564
|
-
@@less_note_printed = true
|
565
|
-
warn <<NOTE
|
566
|
-
* NOTE: Sass and Less are different languages, and they work differently.
|
567
|
-
* I'll do my best to translate, but some features -- especially mixins --
|
568
|
-
* should be checked by hand.
|
569
|
-
NOTE
|
570
|
-
end
|
571
|
-
end
|
572
|
-
>>>>>>> master
|
573
347
|
end
|
574
348
|
end
|
data/lib/sass.rb
ADDED
data/lib/sass/plugin.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
unless Haml::Util.try_sass
|
2
|
+
# Since Bundler sets up our gem environment,
|
3
|
+
# Sass will only be loadable from gem
|
4
|
+
# if gem "sass" has been set.
|
5
|
+
Haml::Util.haml_warn(<<WARNING)
|
6
|
+
Haml will no longer automatically load Sass in Haml 3.2.0.
|
7
|
+
Please add gem 'sass' to your Gemfile.
|
8
|
+
WARNING
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'sass/plugin/configuration'
|
12
|
+
|
13
|
+
ActiveSupport.on_load(:before_initialize) do
|
14
|
+
require 'sass'
|
15
|
+
require 'sass/plugin'
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,201 @@
|
|
1
|
+
# Sass
|
2
|
+
|
3
|
+
**Sass makes CSS fun again**. Sass is an extension of CSS3,
|
4
|
+
adding nested rules, variables, mixins, selector inheritance, and more.
|
5
|
+
It's translated to well-formatted, standard CSS
|
6
|
+
using the command line tool or a web-framework plugin.
|
7
|
+
|
8
|
+
Sass has two syntaxes. The new main syntax (as of Sass 3)
|
9
|
+
is known as "SCSS" (for "Sassy CSS"),
|
10
|
+
and is a superset of CSS3's syntax.
|
11
|
+
This means that every valid CSS3 stylesheet is valid SCSS as well.
|
12
|
+
SCSS files use the extension `.scss`.
|
13
|
+
|
14
|
+
The second, older syntax is known as the indented syntax (or just "Sass").
|
15
|
+
Inspired by Haml's terseness, it's intended for people
|
16
|
+
who prefer conciseness over similarity to CSS.
|
17
|
+
Instead of brackets and semicolons,
|
18
|
+
it uses the indentation of lines to specify blocks.
|
19
|
+
Although no longer the primary syntax,
|
20
|
+
the indented syntax will continue to be supported.
|
21
|
+
Files in the indented syntax use the extension `.sass`.
|
22
|
+
|
23
|
+
## Using
|
24
|
+
|
25
|
+
Sass can be used from the command line
|
26
|
+
or as part of a web framework.
|
27
|
+
The first step is to install the gem:
|
28
|
+
|
29
|
+
gem install sass
|
30
|
+
|
31
|
+
After you convert some CSS to Sass, you can run
|
32
|
+
|
33
|
+
sass style.scss
|
34
|
+
|
35
|
+
to compile it back to CSS.
|
36
|
+
For more information on these commands, check out
|
37
|
+
|
38
|
+
sass --help
|
39
|
+
|
40
|
+
To install Sass in Rails 2,
|
41
|
+
just add `config.gem "sass"` to `config/environment.rb`.
|
42
|
+
In Rails 3, add `gem "sass"` to your Gemfile instead.
|
43
|
+
`.sass` or `.scss` files should be placed in `public/stylesheets/sass`,
|
44
|
+
where they'll be automatically compiled
|
45
|
+
to corresponding CSS files in `public/stylesheets` when needed
|
46
|
+
(the Sass template directory is customizable...
|
47
|
+
see [the Sass reference](http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#template_location-option) for details).
|
48
|
+
|
49
|
+
Sass can also be used with any Rack-enabled web framework.
|
50
|
+
To do so, just add
|
51
|
+
|
52
|
+
require 'sass/plugin/rack'
|
53
|
+
use Sass::Plugin::Rack
|
54
|
+
|
55
|
+
to `config.ru`.
|
56
|
+
Then any Sass files in `public/stylesheets/sass`
|
57
|
+
will be compiled CSS files in `public/stylesheets` on every request.
|
58
|
+
|
59
|
+
To use Sass programatically,
|
60
|
+
check out the [YARD documentation](http://sass-lang.com/docs/yardoc/).
|
61
|
+
|
62
|
+
## Formatting
|
63
|
+
|
64
|
+
Sass is an extension of CSS
|
65
|
+
that adds power and elegance to the basic language.
|
66
|
+
It allows you to use [variables][vars], [nested rules][nested],
|
67
|
+
[mixins][mixins], [inline imports][imports],
|
68
|
+
and more, all with a fully CSS-compatible syntax.
|
69
|
+
Sass helps keep large stylesheets well-organized,
|
70
|
+
and get small stylesheets up and running quickly,
|
71
|
+
particularly with the help of
|
72
|
+
[the Compass style library](http://compass-style.org).
|
73
|
+
|
74
|
+
[vars]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#variables_
|
75
|
+
[nested]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#nested_rules_
|
76
|
+
[mixins]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
|
77
|
+
[imports]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#import
|
78
|
+
|
79
|
+
Sass has two syntaxes.
|
80
|
+
The one presented here, known as "SCSS" (for "Sassy CSS"),
|
81
|
+
is fully CSS-compatible.
|
82
|
+
The other (older) syntax, known as the indented syntax or just "Sass",
|
83
|
+
is whitespace-sensitive and indentation-based.
|
84
|
+
For more information, see the [reference documentation][syntax].
|
85
|
+
|
86
|
+
[syntax]: http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#syntax
|
87
|
+
|
88
|
+
To run the following examples and see the CSS they produce,
|
89
|
+
put them in a file called `test.scss` and run `sass test.scss`.
|
90
|
+
|
91
|
+
### Nesting
|
92
|
+
|
93
|
+
Sass avoids repetition by nesting selectors within one another.
|
94
|
+
The same thing works for properties.
|
95
|
+
|
96
|
+
table.hl {
|
97
|
+
margin: 2em 0;
|
98
|
+
td.ln { text-align: right; }
|
99
|
+
}
|
100
|
+
|
101
|
+
li {
|
102
|
+
font: {
|
103
|
+
family: serif;
|
104
|
+
weight: bold;
|
105
|
+
size: 1.2em;
|
106
|
+
}
|
107
|
+
}
|
108
|
+
|
109
|
+
### Variables
|
110
|
+
|
111
|
+
Use the same color all over the place?
|
112
|
+
Need to do some math with height and width and text size?
|
113
|
+
Sass supports variables, math operations, and many useful functions.
|
114
|
+
|
115
|
+
$blue: #3bbfce;
|
116
|
+
$margin: 16px;
|
117
|
+
|
118
|
+
.content_navigation {
|
119
|
+
border-color: $blue;
|
120
|
+
color: darken($blue, 10%);
|
121
|
+
}
|
122
|
+
|
123
|
+
.border {
|
124
|
+
padding: $margin / 2;
|
125
|
+
margin: $margin / 2;
|
126
|
+
border-color: $blue;
|
127
|
+
}
|
128
|
+
|
129
|
+
### Mixins
|
130
|
+
|
131
|
+
Even more powerful than variables,
|
132
|
+
mixins allow you to re-use whole chunks of CSS,
|
133
|
+
properties or selectors.
|
134
|
+
You can even give them arguments.
|
135
|
+
|
136
|
+
@mixin table-scaffolding {
|
137
|
+
th {
|
138
|
+
text-align: center;
|
139
|
+
font-weight: bold;
|
140
|
+
}
|
141
|
+
td, th { padding: 2px; }
|
142
|
+
}
|
143
|
+
|
144
|
+
@mixin left($dist) {
|
145
|
+
float: left;
|
146
|
+
margin-left: $dist;
|
147
|
+
}
|
148
|
+
|
149
|
+
#data {
|
150
|
+
@include left(10px);
|
151
|
+
@include table-scaffolding;
|
152
|
+
}
|
153
|
+
|
154
|
+
A comprehensive list of features is available
|
155
|
+
in the [Sass reference](http://beta.sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html).
|
156
|
+
|
157
|
+
## Executables
|
158
|
+
|
159
|
+
The Sass gem includes several executables that are useful
|
160
|
+
for dealing with Sass from the command line.
|
161
|
+
|
162
|
+
### `sass`
|
163
|
+
|
164
|
+
The `sass` executable transforms a source Sass file into CSS.
|
165
|
+
See `sass --help` for further information and options.
|
166
|
+
|
167
|
+
### `sass-convert`
|
168
|
+
|
169
|
+
The `sass-convert` executable converts between CSS, Sass, and SCSS.
|
170
|
+
When converting from CSS to Sass or SCSS,
|
171
|
+
nesting is applied where appropriate.
|
172
|
+
See `sass-convert --help` for further information and options.
|
173
|
+
|
174
|
+
## Authors
|
175
|
+
|
176
|
+
Sass was envisioned by [Hampton Catlin](http://hamptoncatlin.com) (hcatlin).
|
177
|
+
However, Hampton doesn't even know his way around the code anymore and now
|
178
|
+
occasionally consults on the language issues. Hampton lives in Jacksonville,
|
179
|
+
Florida and is the lead mobile developer for Wikimedia.
|
180
|
+
|
181
|
+
[Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
|
182
|
+
Sass. His hard work has kept the project alive by endlessly answering forum
|
183
|
+
posts, fixing bugs, refactoring, finding speed improvements, writing
|
184
|
+
documentation, implementing new features, and getting Hampton coffee (a fitting
|
185
|
+
task for a boy-genius). Nathan lives in Seattle, Washington and while not being
|
186
|
+
a student at the University of Washington or working at an internship, he
|
187
|
+
consults for Unspace Interactive.
|
188
|
+
|
189
|
+
[Chris Eppstein](http://acts-as-architect.blogspot.com) is a core contributor to
|
190
|
+
Sass and the creator of Compass, the first Sass-based framework. Chris focuses
|
191
|
+
on making Sass more powerful, easy to use, and on ways to speed its adoption
|
192
|
+
through the web development community. Chris lives in San Jose, California with
|
193
|
+
his wife and daughter. He is the Software Architect for
|
194
|
+
[Caring.com](http://caring.com), a website devoted to the 34 Million caregivers
|
195
|
+
whose parents are sick or elderly, that uses Haml and Sass.
|
196
|
+
|
197
|
+
If you use this software, you must pay Hampton a compliment. And
|
198
|
+
buy Nathan some jelly beans. Maybe pet a kitten. Yeah. Pet that kitty.
|
199
|
+
|
200
|
+
Beyond that, the implementation is licensed under the MIT License.
|
201
|
+
Okay, fine, I guess that means compliments aren't __required__.
|