haml 3.2.0.alpha.10 → 3.2.0.alpha.13
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/.yardopts +19 -7
- data/CHANGELOG.md +1224 -0
- data/FAQ.md +157 -0
- data/README.md +99 -62
- data/REFERENCE.md +1404 -0
- data/Rakefile +52 -341
- data/init.rb +1 -18
- data/lib/haml.rb +6 -30
- data/lib/haml/buffer.rb +37 -16
- data/lib/haml/compiler.rb +52 -13
- data/lib/haml/engine.rb +61 -44
- data/lib/haml/exec.rb +21 -4
- data/lib/haml/filters.rb +136 -166
- data/lib/haml/helpers.rb +37 -10
- data/lib/haml/helpers/action_view_extensions.rb +2 -1
- data/lib/haml/helpers/action_view_mods.rb +67 -181
- data/lib/haml/helpers/rails_323_textarea_fix.rb +39 -0
- data/lib/haml/helpers/xss_mods.rb +9 -11
- data/lib/haml/html.rb +22 -9
- data/lib/haml/html/erb.rb +1 -1
- data/lib/haml/parser.rb +22 -15
- data/lib/haml/railtie.rb +2 -13
- data/lib/haml/template.rb +18 -85
- data/lib/haml/template/options.rb +1 -1
- data/lib/haml/template/plugin.rb +15 -101
- data/lib/haml/util.rb +120 -603
- data/lib/haml/version.rb +1 -107
- data/test/{haml/engine_test.rb → engine_test.rb} +137 -143
- data/test/{haml/erb → erb}/_av_partial_1.erb +1 -1
- data/test/{haml/erb → erb}/_av_partial_2.erb +1 -1
- data/test/{haml/erb → erb}/action_view.erb +1 -1
- data/test/{haml/erb → erb}/standard.erb +0 -0
- data/test/filters_test.rb +141 -0
- data/test/gemfiles/Gemfile.rails-3.0.x +4 -6
- data/test/gemfiles/Gemfile.rails-3.1.x +5 -6
- data/test/gemfiles/Gemfile.rails-3.2.x +6 -0
- data/test/haml-spec/LICENSE +14 -0
- data/test/{haml/spec → haml-spec}/README.md +26 -17
- data/test/haml-spec/lua_haml_spec.lua +38 -0
- data/test/haml-spec/perl_haml_test.pl +81 -0
- data/test/haml-spec/ruby_haml_test.rb +23 -0
- data/test/{haml/spec → haml-spec}/tests.json +132 -54
- data/test/{haml/helper_test.rb → helper_test.rb} +50 -36
- data/test/{haml/html2haml → html2haml}/erb_tests.rb +0 -0
- data/test/{haml/html2haml_test.rb → html2haml_test.rb} +11 -5
- data/test/{haml/markaby → markaby}/standard.mab +0 -0
- data/test/{haml/mocks → mocks}/article.rb +0 -0
- data/test/{haml/results → results}/content_for_layout.xhtml +0 -0
- data/test/{haml/results → results}/eval_suppressed.xhtml +0 -0
- data/test/{haml/results → results}/helpers.xhtml +0 -0
- data/test/{haml/results → results}/helpful.xhtml +0 -0
- data/test/{haml/results → results}/just_stuff.xhtml +0 -0
- data/test/{haml/results → results}/list.xhtml +0 -0
- data/test/{haml/results → results}/nuke_inner_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/nuke_outer_whitespace.xhtml +0 -0
- data/test/{haml/results → results}/original_engine.xhtml +0 -0
- data/test/{haml/results → results}/partial_layout.xhtml +0 -0
- data/test/{haml/results → results}/partials.xhtml +0 -0
- data/test/{haml/results → results}/render_layout.xhtml +0 -0
- data/test/{haml/results → results}/silent_script.xhtml +1 -1
- data/test/{haml/results → results}/standard.xhtml +0 -0
- data/test/{haml/results → results}/tag_parsing.xhtml +0 -0
- data/test/{haml/results → results}/very_basic.xhtml +0 -0
- data/test/{haml/results → results}/whitespace_handling.xhtml +46 -50
- data/test/{haml/template_test.rb → template_test.rb} +20 -81
- data/test/{haml/templates → templates}/_av_partial_1.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_1_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2.haml +1 -1
- data/test/{haml/templates → templates}/_av_partial_2_ugly.haml +1 -1
- data/test/{haml/templates → templates}/_layout.erb +0 -0
- data/test/{haml/templates → templates}/_layout_for_partial.haml +0 -0
- data/test/{haml/templates → templates}/_partial.haml +0 -0
- data/test/{haml/templates → templates}/_text_area.haml +0 -0
- data/test/{haml/templates → templates}/action_view.haml +1 -1
- data/test/{haml/templates → templates}/action_view_ugly.haml +1 -1
- data/test/{haml/templates → templates}/breakage.haml +0 -0
- data/test/{haml/templates → templates}/content_for_layout.haml +0 -0
- data/test/{haml/templates → templates}/eval_suppressed.haml +0 -0
- data/test/{haml/templates → templates}/helpers.haml +0 -0
- data/test/{haml/templates → templates}/helpful.haml +0 -0
- data/test/{haml/templates → templates}/just_stuff.haml +0 -0
- data/test/{haml/templates → templates}/list.haml +0 -0
- data/test/{haml/templates → templates}/nuke_inner_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/nuke_outer_whitespace.haml +0 -0
- data/test/{haml/templates → templates}/original_engine.haml +0 -0
- data/test/templates/partial_layout.haml +3 -0
- data/test/{haml/templates → templates}/partialize.haml +0 -0
- data/test/{haml/templates → templates}/partials.haml +0 -0
- data/test/{haml/templates → templates}/render_layout.haml +0 -0
- data/test/{haml/templates → templates}/silent_script.haml +2 -2
- data/test/{haml/templates → templates}/standard.haml +0 -0
- data/test/{haml/templates → templates}/standard_ugly.haml +0 -0
- data/test/{haml/templates → templates}/tag_parsing.haml +0 -0
- data/test/{haml/templates → templates}/very_basic.haml +0 -0
- data/test/{haml/templates → templates}/whitespace_handling.haml +0 -0
- data/test/test_helper.rb +42 -34
- data/test/util_test.rb +80 -0
- metadata +259 -427
- data/CONTRIBUTING +0 -3
- data/REVISION +0 -1
- data/VERSION +0 -1
- data/VERSION_NAME +0 -1
- data/extra/update_watch.rb +0 -13
- data/lib/haml/root.rb +0 -7
- data/lib/haml/shared.rb +0 -78
- data/lib/haml/template/patch.rb +0 -58
- data/lib/sass.rb +0 -8
- data/lib/sass/plugin.rb +0 -10
- data/lib/sass/rails2_shim.rb +0 -9
- data/lib/sass/rails3_shim.rb +0 -16
- data/test/benchmark.rb +0 -91
- data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
- data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
- data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
- data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
- data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -98
- data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
- data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
- data/test/haml/results/filters.xhtml +0 -62
- data/test/haml/spec/lua_haml_spec.lua +0 -30
- data/test/haml/spec/ruby_haml_test.rb +0 -19
- data/test/haml/spec_test.rb +0 -44
- data/test/haml/templates/filters.haml +0 -66
- data/test/haml/templates/partial_layout.haml +0 -10
- data/test/haml/util_test.rb +0 -300
- data/test/linked_rails.rb +0 -42
- data/vendor/sass/CONTRIBUTING +0 -3
- data/vendor/sass/MIT-LICENSE +0 -20
- data/vendor/sass/README.md +0 -201
- data/vendor/sass/Rakefile +0 -339
- data/vendor/sass/TODO +0 -39
- data/vendor/sass/VERSION +0 -1
- data/vendor/sass/VERSION_NAME +0 -1
- data/vendor/sass/bin/sass +0 -8
- data/vendor/sass/bin/sass-convert +0 -7
- data/vendor/sass/bin/scss +0 -8
- data/vendor/sass/doc-src/FAQ.md +0 -35
- data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
- data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -2327
- data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1965
- data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
- data/vendor/sass/ext/extconf.rb +0 -10
- data/vendor/sass/extra/update_watch.rb +0 -13
- data/vendor/sass/init.rb +0 -18
- data/vendor/sass/lib/sass.rb +0 -73
- data/vendor/sass/lib/sass/cache_stores.rb +0 -15
- data/vendor/sass/lib/sass/cache_stores/base.rb +0 -86
- data/vendor/sass/lib/sass/cache_stores/chain.rb +0 -33
- data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -60
- data/vendor/sass/lib/sass/cache_stores/memory.rb +0 -47
- data/vendor/sass/lib/sass/cache_stores/null.rb +0 -25
- data/vendor/sass/lib/sass/callbacks.rb +0 -66
- data/vendor/sass/lib/sass/css.rb +0 -295
- data/vendor/sass/lib/sass/engine.rb +0 -878
- data/vendor/sass/lib/sass/environment.rb +0 -166
- data/vendor/sass/lib/sass/error.rb +0 -201
- data/vendor/sass/lib/sass/exec.rb +0 -672
- data/vendor/sass/lib/sass/importers.rb +0 -22
- data/vendor/sass/lib/sass/importers/base.rb +0 -139
- data/vendor/sass/lib/sass/importers/filesystem.rb +0 -149
- data/vendor/sass/lib/sass/less.rb +0 -382
- data/vendor/sass/lib/sass/logger.rb +0 -15
- data/vendor/sass/lib/sass/logger/base.rb +0 -32
- data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
- data/vendor/sass/lib/sass/plugin.rb +0 -132
- data/vendor/sass/lib/sass/plugin/compiler.rb +0 -383
- data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
- data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
- data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
- data/vendor/sass/lib/sass/plugin/rack.rb +0 -60
- data/vendor/sass/lib/sass/plugin/rails.rb +0 -47
- data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -173
- data/vendor/sass/lib/sass/railtie.rb +0 -9
- data/vendor/sass/lib/sass/repl.rb +0 -58
- data/vendor/sass/lib/sass/root.rb +0 -7
- data/vendor/sass/lib/sass/script.rb +0 -40
- data/vendor/sass/lib/sass/script/bool.rb +0 -18
- data/vendor/sass/lib/sass/script/color.rb +0 -480
- data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
- data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
- data/vendor/sass/lib/sass/script/funcall.rb +0 -175
- data/vendor/sass/lib/sass/script/functions.rb +0 -1386
- data/vendor/sass/lib/sass/script/interpolation.rb +0 -79
- data/vendor/sass/lib/sass/script/lexer.rb +0 -339
- data/vendor/sass/lib/sass/script/list.rb +0 -83
- data/vendor/sass/lib/sass/script/literal.rb +0 -250
- data/vendor/sass/lib/sass/script/node.rb +0 -99
- data/vendor/sass/lib/sass/script/number.rb +0 -452
- data/vendor/sass/lib/sass/script/operation.rb +0 -99
- data/vendor/sass/lib/sass/script/parser.rb +0 -474
- data/vendor/sass/lib/sass/script/string.rb +0 -51
- data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -103
- data/vendor/sass/lib/sass/script/unary_operation.rb +0 -64
- data/vendor/sass/lib/sass/script/variable.rb +0 -59
- data/vendor/sass/lib/sass/scss.rb +0 -17
- data/vendor/sass/lib/sass/scss/css_parser.rb +0 -46
- data/vendor/sass/lib/sass/scss/parser.rb +0 -960
- data/vendor/sass/lib/sass/scss/rx.rb +0 -128
- data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
- data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
- data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
- data/vendor/sass/lib/sass/selector.rb +0 -361
- data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
- data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -81
- data/vendor/sass/lib/sass/selector/sequence.rb +0 -233
- data/vendor/sass/lib/sass/selector/simple.rb +0 -113
- data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -134
- data/vendor/sass/lib/sass/shared.rb +0 -78
- data/vendor/sass/lib/sass/tree/charset_node.rb +0 -22
- data/vendor/sass/lib/sass/tree/comment_node.rb +0 -90
- data/vendor/sass/lib/sass/tree/debug_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/directive_node.rb +0 -23
- data/vendor/sass/lib/sass/tree/each_node.rb +0 -24
- data/vendor/sass/lib/sass/tree/extend_node.rb +0 -29
- data/vendor/sass/lib/sass/tree/for_node.rb +0 -36
- data/vendor/sass/lib/sass/tree/function_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/if_node.rb +0 -52
- data/vendor/sass/lib/sass/tree/import_node.rb +0 -68
- data/vendor/sass/lib/sass/tree/media_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -27
- data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -32
- data/vendor/sass/lib/sass/tree/node.rb +0 -201
- data/vendor/sass/lib/sass/tree/prop_node.rb +0 -148
- data/vendor/sass/lib/sass/tree/return_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/root_node.rb +0 -28
- data/vendor/sass/lib/sass/tree/rule_node.rb +0 -136
- data/vendor/sass/lib/sass/tree/variable_node.rb +0 -30
- data/vendor/sass/lib/sass/tree/visitors/base.rb +0 -75
- data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +0 -133
- data/vendor/sass/lib/sass/tree/visitors/convert.rb +0 -260
- data/vendor/sass/lib/sass/tree/visitors/cssize.rb +0 -175
- data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
- data/vendor/sass/lib/sass/tree/visitors/perform.rb +0 -332
- data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
- data/vendor/sass/lib/sass/tree/visitors/to_css.rb +0 -210
- data/vendor/sass/lib/sass/tree/warn_node.rb +0 -18
- data/vendor/sass/lib/sass/tree/while_node.rb +0 -18
- data/vendor/sass/lib/sass/util.rb +0 -721
- data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
- data/vendor/sass/lib/sass/version.rb +0 -112
- data/vendor/sass/rails/init.rb +0 -1
- data/vendor/sass/sass.gemspec +0 -33
- data/vendor/sass/test/Gemfile +0 -4
- data/vendor/sass/test/Gemfile.lock +0 -19
- data/vendor/sass/test/sass/cache_test.rb +0 -89
- data/vendor/sass/test/sass/callbacks_test.rb +0 -61
- data/vendor/sass/test/sass/conversion_test.rb +0 -1199
- data/vendor/sass/test/sass/css2sass_test.rb +0 -373
- data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
- data/vendor/sass/test/sass/engine_test.rb +0 -2567
- data/vendor/sass/test/sass/extend_test.rb +0 -1348
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
- data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
- data/vendor/sass/test/sass/functions_test.rb +0 -1038
- data/vendor/sass/test/sass/importer_test.rb +0 -192
- data/vendor/sass/test/sass/less_conversion_test.rb +0 -653
- data/vendor/sass/test/sass/logger_test.rb +0 -58
- data/vendor/sass/test/sass/mock_importer.rb +0 -49
- data/vendor/sass/test/sass/more_results/more1.css +0 -9
- data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
- data/vendor/sass/test/sass/more_results/more_import.css +0 -29
- data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
- data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
- data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
- data/vendor/sass/test/sass/plugin_test.rb +0 -472
- data/vendor/sass/test/sass/results/alt.css +0 -4
- data/vendor/sass/test/sass/results/basic.css +0 -9
- data/vendor/sass/test/sass/results/compact.css +0 -5
- data/vendor/sass/test/sass/results/complex.css +0 -86
- data/vendor/sass/test/sass/results/compressed.css +0 -1
- data/vendor/sass/test/sass/results/expanded.css +0 -19
- data/vendor/sass/test/sass/results/if.css +0 -3
- data/vendor/sass/test/sass/results/import.css +0 -31
- data/vendor/sass/test/sass/results/import_charset.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_1_8.css +0 -4
- data/vendor/sass/test/sass/results/import_charset_ibm866.css +0 -4
- data/vendor/sass/test/sass/results/line_numbers.css +0 -49
- data/vendor/sass/test/sass/results/mixins.css +0 -95
- data/vendor/sass/test/sass/results/multiline.css +0 -24
- data/vendor/sass/test/sass/results/nested.css +0 -22
- data/vendor/sass/test/sass/results/options.css +0 -1
- data/vendor/sass/test/sass/results/parent_ref.css +0 -13
- data/vendor/sass/test/sass/results/script.css +0 -16
- data/vendor/sass/test/sass/results/scss_import.css +0 -31
- data/vendor/sass/test/sass/results/scss_importee.css +0 -2
- data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
- data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
- data/vendor/sass/test/sass/results/units.css +0 -11
- 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 +0 -285
- data/vendor/sass/test/sass/script_test.rb +0 -514
- data/vendor/sass/test/sass/scss/css_test.rb +0 -922
- data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
- data/vendor/sass/test/sass/scss/scss_test.rb +0 -1273
- data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
- data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +0 -4
- data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +0 -4
- data/vendor/sass/test/sass/templates/_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/alt.sass +0 -16
- data/vendor/sass/test/sass/templates/basic.sass +0 -23
- data/vendor/sass/test/sass/templates/bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/bork5.sass +0 -3
- data/vendor/sass/test/sass/templates/compact.sass +0 -17
- data/vendor/sass/test/sass/templates/complex.sass +0 -305
- data/vendor/sass/test/sass/templates/compressed.sass +0 -15
- data/vendor/sass/test/sass/templates/expanded.sass +0 -17
- data/vendor/sass/test/sass/templates/if.sass +0 -11
- data/vendor/sass/test/sass/templates/import.sass +0 -12
- data/vendor/sass/test/sass/templates/import_charset.sass +0 -7
- data/vendor/sass/test/sass/templates/import_charset_1_8.sass +0 -4
- data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +0 -9
- data/vendor/sass/test/sass/templates/importee.less +0 -2
- data/vendor/sass/test/sass/templates/importee.sass +0 -19
- data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
- data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
- data/vendor/sass/test/sass/templates/mixins.sass +0 -76
- data/vendor/sass/test/sass/templates/multiline.sass +0 -20
- data/vendor/sass/test/sass/templates/nested.sass +0 -25
- data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_import.sass +0 -2
- data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
- data/vendor/sass/test/sass/templates/options.sass +0 -2
- data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
- data/vendor/sass/test/sass/templates/script.sass +0 -101
- data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
- data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
- data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
- data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
- data/vendor/sass/test/sass/templates/units.sass +0 -11
- data/vendor/sass/test/sass/templates/warn.sass +0 -3
- data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
- data/vendor/sass/test/sass/test_helper.rb +0 -8
- data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
- data/vendor/sass/test/sass/util_test.rb +0 -266
- data/vendor/sass/test/test_helper.rb +0 -69
- data/vendor/sass/vendor/fssm/Gemfile +0 -3
- data/vendor/sass/vendor/fssm/LICENSE +0 -20
- data/vendor/sass/vendor/fssm/README.markdown +0 -83
- data/vendor/sass/vendor/fssm/Rakefile +0 -11
- data/vendor/sass/vendor/fssm/example.rb +0 -12
- data/vendor/sass/vendor/fssm/fssm.gemspec +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm.rb +0 -37
- data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
- data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
- data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
- data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/path.rb +0 -94
- data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +0 -36
- data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +0 -75
- data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +0 -24
- data/vendor/sass/vendor/fssm/lib/fssm/support.rb +0 -92
- data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +0 -176
- data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
- data/vendor/sass/vendor/fssm/profile/prof-cache.rb +0 -40
- data/vendor/sass/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
- data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
- data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +0 -68
- data/vendor/sass/vendor/fssm/profile/prof-plain-pathname.html +0 -988
- data/vendor/sass/vendor/fssm/profile/prof.html +0 -2379
- data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
- data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
- data/vendor/sass/vendor/fssm/spec/path_spec.rb +0 -96
- 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 +0 -14
- data/vendor/sass/yard/callbacks.rb +0 -29
- data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
- data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
- data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'sass/logger/log_level'
|
2
|
-
|
3
|
-
class Sass::Logger::Base
|
4
|
-
|
5
|
-
include Sass::Logger::LogLevel
|
6
|
-
|
7
|
-
attr_accessor :log_level
|
8
|
-
attr_accessor :disabled
|
9
|
-
|
10
|
-
log_level :trace
|
11
|
-
log_level :debug
|
12
|
-
log_level :info
|
13
|
-
log_level :warn
|
14
|
-
log_level :error
|
15
|
-
|
16
|
-
def initialize(log_level = :debug)
|
17
|
-
self.log_level = log_level
|
18
|
-
end
|
19
|
-
|
20
|
-
def logging_level?(level)
|
21
|
-
!disabled && self.class.log_level?(level, log_level)
|
22
|
-
end
|
23
|
-
|
24
|
-
def log(level, message)
|
25
|
-
self._log(level, message) if logging_level?(level)
|
26
|
-
end
|
27
|
-
|
28
|
-
def _log(level, message)
|
29
|
-
Kernel::warn(message)
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module Sass
|
2
|
-
module Logger
|
3
|
-
module LogLevel
|
4
|
-
|
5
|
-
def self.included(base)
|
6
|
-
base.extend(ClassMethods)
|
7
|
-
end
|
8
|
-
|
9
|
-
module ClassMethods
|
10
|
-
def inherited(subclass)
|
11
|
-
subclass.log_levels = subclass.superclass.log_levels.dup
|
12
|
-
end
|
13
|
-
|
14
|
-
def log_levels
|
15
|
-
@log_levels ||= {}
|
16
|
-
end
|
17
|
-
|
18
|
-
def log_levels=(levels)
|
19
|
-
@log_levels = levels
|
20
|
-
end
|
21
|
-
|
22
|
-
def log_level?(level, min_level)
|
23
|
-
log_levels[level] >= log_levels[min_level]
|
24
|
-
end
|
25
|
-
|
26
|
-
def log_level(name, options = {})
|
27
|
-
if options[:prepend]
|
28
|
-
level = log_levels.values.min
|
29
|
-
level = level.nil? ? 0 : level - 1
|
30
|
-
else
|
31
|
-
level = log_levels.values.max
|
32
|
-
level = level.nil? ? 0 : level + 1
|
33
|
-
end
|
34
|
-
log_levels.update(name => level)
|
35
|
-
define_logger(name)
|
36
|
-
end
|
37
|
-
|
38
|
-
def define_logger(name, options = {})
|
39
|
-
class_eval %Q{
|
40
|
-
def #{name}(message)
|
41
|
-
#{options.fetch(:to, :log)}(#{name.inspect}, message)
|
42
|
-
end
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
require 'sass'
|
4
|
-
require 'sass/plugin/compiler'
|
5
|
-
|
6
|
-
module Sass
|
7
|
-
# This module provides a single interface to the compilation of Sass/SCSS files
|
8
|
-
# for an application. It provides global options and checks whether CSS files
|
9
|
-
# need to be updated.
|
10
|
-
#
|
11
|
-
# This module is used as the primary interface with Sass
|
12
|
-
# when it's used as a plugin for various frameworks.
|
13
|
-
# All Rack-enabled frameworks are supported out of the box.
|
14
|
-
# The plugin is {file:SASS_REFERENCE.md#rails_merb_plugin automatically activated for Rails and Merb}.
|
15
|
-
# Other frameworks must enable it explicitly; see {Sass::Plugin::Rack}.
|
16
|
-
#
|
17
|
-
# This module has a large set of callbacks available
|
18
|
-
# to allow users to run code (such as logging) when certain things happen.
|
19
|
-
# All callback methods are of the form `on_#{name}`,
|
20
|
-
# and they all take a block that's called when the given action occurs.
|
21
|
-
#
|
22
|
-
# Note that this class proxies almost all methods to its {Sass::Plugin::Compiler} instance.
|
23
|
-
# See \{#compiler}.
|
24
|
-
#
|
25
|
-
# @example Using a callback
|
26
|
-
# Sass::Plugin.on_updating_stylesheet do |template, css|
|
27
|
-
# puts "Compiling #{template} to #{css}"
|
28
|
-
# end
|
29
|
-
# Sass::Plugin.update_stylesheets
|
30
|
-
# #=> Compiling app/sass/screen.scss to public/stylesheets/screen.css
|
31
|
-
# #=> Compiling app/sass/print.scss to public/stylesheets/print.css
|
32
|
-
# #=> Compiling app/sass/ie.scss to public/stylesheets/ie.css
|
33
|
-
# @see Sass::Plugin::Compiler
|
34
|
-
module Plugin
|
35
|
-
include Sass::Util
|
36
|
-
extend self
|
37
|
-
|
38
|
-
@checked_for_updates = false
|
39
|
-
|
40
|
-
# Whether or not Sass has **ever** checked if the stylesheets need to be updated
|
41
|
-
# (in this Ruby instance).
|
42
|
-
#
|
43
|
-
# @return [Boolean]
|
44
|
-
attr_accessor :checked_for_updates
|
45
|
-
|
46
|
-
# Same as \{#update\_stylesheets}, but respects \{#checked\_for\_updates}
|
47
|
-
# and the {file:SASS_REFERENCE.md#always_update-option `:always_update`}
|
48
|
-
# and {file:SASS_REFERENCE.md#always_check-option `:always_check`} options.
|
49
|
-
#
|
50
|
-
# @see #update_stylesheets
|
51
|
-
def check_for_updates
|
52
|
-
return unless !Sass::Plugin.checked_for_updates ||
|
53
|
-
Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check]
|
54
|
-
update_stylesheets
|
55
|
-
end
|
56
|
-
|
57
|
-
# Returns the singleton compiler instance.
|
58
|
-
# This compiler has been pre-configured according
|
59
|
-
# to the plugin configuration.
|
60
|
-
#
|
61
|
-
# @return [Sass::Plugin::Compiler]
|
62
|
-
def compiler
|
63
|
-
@compiler ||= Compiler.new
|
64
|
-
end
|
65
|
-
|
66
|
-
# Updates out-of-date stylesheets.
|
67
|
-
#
|
68
|
-
# Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
|
69
|
-
# to see if it's been modified more recently than the corresponding CSS file
|
70
|
-
# in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
|
71
|
-
# If it has, it updates the CSS file.
|
72
|
-
#
|
73
|
-
# @param individual_files [Array<(String, String)>]
|
74
|
-
# A list of files to check for updates
|
75
|
-
# **in addition to those specified by the
|
76
|
-
# {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
|
77
|
-
# The first string in each pair is the location of the Sass/SCSS file,
|
78
|
-
# the second is the location of the CSS file that it should be compiled to.
|
79
|
-
def update_stylesheets(individual_files = [])
|
80
|
-
return if options[:never_update]
|
81
|
-
compiler.update_stylesheets(individual_files)
|
82
|
-
end
|
83
|
-
|
84
|
-
# Updates all stylesheets, even those that aren't out-of-date.
|
85
|
-
# Ignores the cache.
|
86
|
-
#
|
87
|
-
# @param individual_files [Array<(String, String)>]
|
88
|
-
# A list of files to check for updates
|
89
|
-
# **in addition to those specified by the
|
90
|
-
# {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
|
91
|
-
# The first string in each pair is the location of the Sass/SCSS file,
|
92
|
-
# the second is the location of the CSS file that it should be compiled to.
|
93
|
-
# @see #update_stylesheets
|
94
|
-
def force_update_stylesheets(individual_files = [])
|
95
|
-
Compiler.new(options.dup.merge(
|
96
|
-
:never_update => false,
|
97
|
-
:always_update => true,
|
98
|
-
:cache => false)).update_stylesheets(individual_files)
|
99
|
-
end
|
100
|
-
|
101
|
-
# All other method invocations are proxied to the \{#compiler}.
|
102
|
-
#
|
103
|
-
# @see #compiler
|
104
|
-
# @see Sass::Plugin::Compiler
|
105
|
-
def method_missing(method, *args, &block)
|
106
|
-
if compiler.respond_to?(method)
|
107
|
-
compiler.send(method, *args, &block)
|
108
|
-
else
|
109
|
-
super
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# For parity with method_missing
|
114
|
-
def respond_to?(method)
|
115
|
-
super || compiler.respond_to?(method)
|
116
|
-
end
|
117
|
-
|
118
|
-
# There's a small speedup by not using method missing for frequently delegated methods.
|
119
|
-
def options
|
120
|
-
compiler.options
|
121
|
-
end
|
122
|
-
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
if defined?(ActionController)
|
127
|
-
require 'sass/plugin/rails'
|
128
|
-
elsif defined?(Merb::Plugins)
|
129
|
-
require 'sass/plugin/merb'
|
130
|
-
else
|
131
|
-
require 'sass/plugin/generic'
|
132
|
-
end
|
@@ -1,383 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
require 'sass'
|
4
|
-
# XXX CE: is this still necessary now that we have the compiler class?
|
5
|
-
require 'sass/callbacks'
|
6
|
-
require 'sass/plugin/configuration'
|
7
|
-
require 'sass/plugin/staleness_checker'
|
8
|
-
|
9
|
-
module Sass::Plugin
|
10
|
-
|
11
|
-
# The Compiler class handles compilation of multiple files and/or directories,
|
12
|
-
# including checking which CSS files are out-of-date and need to be updated
|
13
|
-
# and calling Sass to perform the compilation on those files.
|
14
|
-
#
|
15
|
-
# {Sass::Plugin} uses this class to update stylesheets for a single application.
|
16
|
-
# Unlike {Sass::Plugin}, though, the Compiler class has no global state,
|
17
|
-
# and so multiple instances may be created and used independently.
|
18
|
-
#
|
19
|
-
# If you need to compile a Sass string into CSS,
|
20
|
-
# please see the {Sass::Engine} class.
|
21
|
-
#
|
22
|
-
# Unlike {Sass::Plugin}, this class doesn't keep track of
|
23
|
-
# whether or how many times a stylesheet should be updated.
|
24
|
-
# Therefore, the following `Sass::Plugin` options are ignored by the Compiler:
|
25
|
-
#
|
26
|
-
# * `:never_update`
|
27
|
-
# * `:always_check`
|
28
|
-
class Compiler
|
29
|
-
include Sass::Util
|
30
|
-
include Configuration
|
31
|
-
extend Sass::Callbacks
|
32
|
-
|
33
|
-
# Creates a new compiler.
|
34
|
-
#
|
35
|
-
# @param options [{Symbol => Object}]
|
36
|
-
# See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
|
37
|
-
def initialize(options = {})
|
38
|
-
self.options.merge!(options)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Register a callback to be run after stylesheets are mass-updated.
|
42
|
-
# This is run whenever \{#update\_stylesheets} is called,
|
43
|
-
# unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
|
44
|
-
# is enabled.
|
45
|
-
#
|
46
|
-
# @yield [individual_files]
|
47
|
-
# @yieldparam individual_files [<(String, String)>]
|
48
|
-
# Individual files to be updated, in addition to the directories
|
49
|
-
# specified in the options.
|
50
|
-
# The first element of each pair is the source file,
|
51
|
-
# the second is the target CSS file.
|
52
|
-
define_callback :updating_stylesheets
|
53
|
-
|
54
|
-
# Register a callback to be run after a single stylesheet is updated.
|
55
|
-
# The callback is only run if the stylesheet is really updated;
|
56
|
-
# if the CSS file is fresh, this won't be run.
|
57
|
-
#
|
58
|
-
# Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
|
59
|
-
# is enabled, this callback won't be run
|
60
|
-
# when an exception CSS file is being written.
|
61
|
-
# To run an action for those files, use \{#on\_compilation\_error}.
|
62
|
-
#
|
63
|
-
# @yield [template, css]
|
64
|
-
# @yieldparam template [String]
|
65
|
-
# The location of the Sass/SCSS file being updated.
|
66
|
-
# @yieldparam css [String]
|
67
|
-
# The location of the CSS file being generated.
|
68
|
-
define_callback :updated_stylesheet
|
69
|
-
|
70
|
-
# Register a callback to be run before a single stylesheet is updated.
|
71
|
-
# The callback is only run if the stylesheet is guaranteed to be updated;
|
72
|
-
# if the CSS file is fresh, this won't be run.
|
73
|
-
#
|
74
|
-
# Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
|
75
|
-
# is enabled, this callback won't be run
|
76
|
-
# when an exception CSS file is being written.
|
77
|
-
# To run an action for those files, use \{#on\_compilation\_error}.
|
78
|
-
#
|
79
|
-
# @yield [template, css]
|
80
|
-
# @yieldparam template [String]
|
81
|
-
# The location of the Sass/SCSS file being updated.
|
82
|
-
# @yieldparam css [String]
|
83
|
-
# The location of the CSS file being generated.
|
84
|
-
define_callback :updating_stylesheet
|
85
|
-
|
86
|
-
def on_updating_stylesheet_with_deprecation_warning(&block)
|
87
|
-
Sass::Util.sass_warn("Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is run after stylesheet compilation.")
|
88
|
-
on_updating_stylesheet_without_deprecation_warning(&block)
|
89
|
-
end
|
90
|
-
alias_method :on_updating_stylesheet_without_deprecation_warning, :on_updating_stylesheet
|
91
|
-
alias_method :on_updating_stylesheet, :on_updating_stylesheet_with_deprecation_warning
|
92
|
-
|
93
|
-
# Register a callback to be run when Sass decides not to update a stylesheet.
|
94
|
-
# In particular, the callback is run when Sass finds that
|
95
|
-
# the template file and none of its dependencies
|
96
|
-
# have been modified since the last compilation.
|
97
|
-
#
|
98
|
-
# Note that this is **not** run when the
|
99
|
-
# \{file:SASS_REFERENCE.md#never-update_option `:never_update` option} is set,
|
100
|
-
# nor when Sass decides not to compile a partial.
|
101
|
-
#
|
102
|
-
# @yield [template, css]
|
103
|
-
# @yieldparam template [String]
|
104
|
-
# The location of the Sass/SCSS file not being updated.
|
105
|
-
# @yieldparam css [String]
|
106
|
-
# The location of the CSS file not being generated.
|
107
|
-
define_callback :not_updating_stylesheet
|
108
|
-
|
109
|
-
# Register a callback to be run when there's an error
|
110
|
-
# compiling a Sass file.
|
111
|
-
# This could include not only errors in the Sass document,
|
112
|
-
# but also errors accessing the file at all.
|
113
|
-
#
|
114
|
-
# @yield [error, template, css]
|
115
|
-
# @yieldparam error [Exception] The exception that was raised.
|
116
|
-
# @yieldparam template [String]
|
117
|
-
# The location of the Sass/SCSS file being updated.
|
118
|
-
# @yieldparam css [String]
|
119
|
-
# The location of the CSS file being generated.
|
120
|
-
define_callback :compilation_error
|
121
|
-
|
122
|
-
# Register a callback to be run when Sass creates a directory
|
123
|
-
# into which to put CSS files.
|
124
|
-
#
|
125
|
-
# Note that even if multiple levels of directories need to be created,
|
126
|
-
# the callback may only be run once.
|
127
|
-
# For example, if "foo/" exists and "foo/bar/baz/" needs to be created,
|
128
|
-
# this may only be run for "foo/bar/baz/".
|
129
|
-
# This is not a guarantee, however;
|
130
|
-
# it may also be run for "foo/bar/".
|
131
|
-
#
|
132
|
-
# @yield [dirname]
|
133
|
-
# @yieldparam dirname [String]
|
134
|
-
# The location of the directory that was created.
|
135
|
-
define_callback :creating_directory
|
136
|
-
|
137
|
-
# Register a callback to be run when Sass detects
|
138
|
-
# that a template has been modified.
|
139
|
-
# This is only run when using \{#watch}.
|
140
|
-
#
|
141
|
-
# @yield [template]
|
142
|
-
# @yieldparam template [String]
|
143
|
-
# The location of the template that was modified.
|
144
|
-
define_callback :template_modified
|
145
|
-
|
146
|
-
# Register a callback to be run when Sass detects
|
147
|
-
# that a new template has been created.
|
148
|
-
# This is only run when using \{#watch}.
|
149
|
-
#
|
150
|
-
# @yield [template]
|
151
|
-
# @yieldparam template [String]
|
152
|
-
# The location of the template that was created.
|
153
|
-
define_callback :template_created
|
154
|
-
|
155
|
-
# Register a callback to be run when Sass detects
|
156
|
-
# that a template has been deleted.
|
157
|
-
# This is only run when using \{#watch}.
|
158
|
-
#
|
159
|
-
# @yield [template]
|
160
|
-
# @yieldparam template [String]
|
161
|
-
# The location of the template that was deleted.
|
162
|
-
define_callback :template_deleted
|
163
|
-
|
164
|
-
# Register a callback to be run when Sass deletes a CSS file.
|
165
|
-
# This happens when the corresponding Sass/SCSS file has been deleted.
|
166
|
-
#
|
167
|
-
# @yield [filename]
|
168
|
-
# @yieldparam filename [String]
|
169
|
-
# The location of the CSS file that was deleted.
|
170
|
-
define_callback :deleting_css
|
171
|
-
|
172
|
-
# Updates out-of-date stylesheets.
|
173
|
-
#
|
174
|
-
# Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
|
175
|
-
# to see if it's been modified more recently than the corresponding CSS file
|
176
|
-
# in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
|
177
|
-
# If it has, it updates the CSS file.
|
178
|
-
#
|
179
|
-
# @param individual_files [Array<(String, String)>]
|
180
|
-
# A list of files to check for updates
|
181
|
-
# **in addition to those specified by the
|
182
|
-
# {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
|
183
|
-
# The first string in each pair is the location of the Sass/SCSS file,
|
184
|
-
# the second is the location of the CSS file that it should be compiled to.
|
185
|
-
def update_stylesheets(individual_files = [])
|
186
|
-
Sass::Plugin.checked_for_updates = true
|
187
|
-
staleness_checker = StalenessChecker.new(engine_options)
|
188
|
-
|
189
|
-
template_location_array.each do |template_location, css_location|
|
190
|
-
Dir.glob(File.join(template_location, "**", "[^_]*.s[ca]ss")).sort.each do |file|
|
191
|
-
# Get the relative path to the file
|
192
|
-
name = file.sub(template_location.to_s.sub(/\/*$/, '/'), "")
|
193
|
-
css = css_filename(name, css_location)
|
194
|
-
individual_files << [file, css]
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
run_updating_stylesheets individual_files
|
199
|
-
|
200
|
-
individual_files.each do |file, css|
|
201
|
-
if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
|
202
|
-
update_stylesheet(file, css)
|
203
|
-
else
|
204
|
-
run_not_updating_stylesheet(file, css)
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
# Watches the template directory (or directories)
|
210
|
-
# and updates the CSS files whenever the related Sass/SCSS files change.
|
211
|
-
# `watch` never returns.
|
212
|
-
#
|
213
|
-
# Whenever a change is detected to a Sass/SCSS file in
|
214
|
-
# {file:SASS_REFERENCE.md#template_location-option `:template_location`},
|
215
|
-
# the corresponding CSS file in {file:SASS_REFERENCE.md#css_location-option `:css_location`}
|
216
|
-
# will be recompiled.
|
217
|
-
# The CSS files of any Sass/SCSS files that import the changed file will also be recompiled.
|
218
|
-
#
|
219
|
-
# Before the watching starts in earnest, `watch` calls \{#update\_stylesheets}.
|
220
|
-
#
|
221
|
-
# Note that `watch` uses the [FSSM](http://github.com/ttilley/fssm) library
|
222
|
-
# to monitor the filesystem for changes.
|
223
|
-
# FSSM isn't loaded until `watch` is run.
|
224
|
-
# The version of FSSM distributed with Sass is loaded by default,
|
225
|
-
# but if another version has already been loaded that will be used instead.
|
226
|
-
#
|
227
|
-
# @param individual_files [Array<(String, String)>]
|
228
|
-
# A list of files to watch for updates
|
229
|
-
# **in addition to those specified by the
|
230
|
-
# {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
|
231
|
-
# The first string in each pair is the location of the Sass/SCSS file,
|
232
|
-
# the second is the location of the CSS file that it should be compiled to.
|
233
|
-
def watch(individual_files = [])
|
234
|
-
update_stylesheets(individual_files)
|
235
|
-
|
236
|
-
begin
|
237
|
-
require 'fssm'
|
238
|
-
rescue LoadError => e
|
239
|
-
dir = Sass::Util.scope("vendor/fssm/lib")
|
240
|
-
if $LOAD_PATH.include?(dir)
|
241
|
-
e.message << "\n" <<
|
242
|
-
if File.exists?(scope(".git"))
|
243
|
-
'Run "git submodule update --init" to get the recommended version.'
|
244
|
-
else
|
245
|
-
'Run "gem install fssm" to get it.'
|
246
|
-
end
|
247
|
-
raise e
|
248
|
-
else
|
249
|
-
$LOAD_PATH.unshift dir
|
250
|
-
retry
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
unless individual_files.empty? && FSSM::Backends::Default.name == "FSSM::Backends::FSEvents"
|
255
|
-
# As of FSSM 0.1.4, it doesn't support FSevents on individual files,
|
256
|
-
# but it also isn't smart enough to switch to polling itself.
|
257
|
-
require 'fssm/backends/polling'
|
258
|
-
Sass::Util.silence_warnings do
|
259
|
-
FSSM::Backends.const_set(:Default, FSSM::Backends::Polling)
|
260
|
-
end
|
261
|
-
end
|
262
|
-
|
263
|
-
# TODO: Keep better track of what depends on what
|
264
|
-
# so we don't have to run a global update every time anything changes.
|
265
|
-
FSSM.monitor do |mon|
|
266
|
-
template_location_array.each do |template_location, css_location|
|
267
|
-
mon.path template_location do |path|
|
268
|
-
path.glob '**/*.s[ac]ss'
|
269
|
-
|
270
|
-
path.update do |base, relative|
|
271
|
-
run_template_modified File.join(base, relative)
|
272
|
-
update_stylesheets(individual_files)
|
273
|
-
end
|
274
|
-
|
275
|
-
path.create do |base, relative|
|
276
|
-
run_template_created File.join(base, relative)
|
277
|
-
update_stylesheets(individual_files)
|
278
|
-
end
|
279
|
-
|
280
|
-
path.delete do |base, relative|
|
281
|
-
run_template_deleted File.join(base, relative)
|
282
|
-
css = File.join(css_location, relative.gsub(/\.s[ac]ss$/, '.css'))
|
283
|
-
try_delete_css css
|
284
|
-
update_stylesheets(individual_files)
|
285
|
-
end
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
individual_files.each do |template, css|
|
290
|
-
mon.file template do |path|
|
291
|
-
path.update do
|
292
|
-
run_template_modified template
|
293
|
-
update_stylesheets(individual_files)
|
294
|
-
end
|
295
|
-
|
296
|
-
path.create do
|
297
|
-
run_template_created template
|
298
|
-
update_stylesheets(individual_files)
|
299
|
-
end
|
300
|
-
|
301
|
-
path.delete do
|
302
|
-
run_template_deleted template
|
303
|
-
try_delete_css css
|
304
|
-
update_stylesheets(individual_files)
|
305
|
-
end
|
306
|
-
end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
# Non-destructively modifies \{#options} so that default values are properly set,
|
312
|
-
# and returns the result.
|
313
|
-
#
|
314
|
-
# @param additional_options [{Symbol => Object}] An options hash with which to merge \{#options}
|
315
|
-
# @return [{Symbol => Object}] The modified options hash
|
316
|
-
def engine_options(additional_options = {})
|
317
|
-
opts = options.merge(additional_options)
|
318
|
-
opts[:load_paths] = load_paths(opts)
|
319
|
-
opts
|
320
|
-
end
|
321
|
-
|
322
|
-
# Compass expects this to exist
|
323
|
-
def stylesheet_needs_update?(css_file, template_file)
|
324
|
-
StalenessChecker.stylesheet_needs_update?(css_file, template_file)
|
325
|
-
end
|
326
|
-
|
327
|
-
private
|
328
|
-
|
329
|
-
def update_stylesheet(filename, css)
|
330
|
-
dir = File.dirname(css)
|
331
|
-
unless File.exists?(dir)
|
332
|
-
run_creating_directory dir
|
333
|
-
FileUtils.mkdir_p dir
|
334
|
-
end
|
335
|
-
|
336
|
-
begin
|
337
|
-
File.read(filename) unless File.readable?(filename) # triggers an error for handling
|
338
|
-
engine_opts = engine_options(:css_filename => css, :filename => filename)
|
339
|
-
result = Sass::Engine.for_file(filename, engine_opts).render
|
340
|
-
rescue Exception => e
|
341
|
-
compilation_error_occured = true
|
342
|
-
run_compilation_error e, filename, css
|
343
|
-
result = Sass::SyntaxError.exception_to_css(e, options)
|
344
|
-
else
|
345
|
-
run_updating_stylesheet filename, css
|
346
|
-
end
|
347
|
-
|
348
|
-
write_file(css, result)
|
349
|
-
run_updated_stylesheet(filename, css) unless compilation_error_occured
|
350
|
-
end
|
351
|
-
|
352
|
-
def write_file(css, content)
|
353
|
-
flag = 'w'
|
354
|
-
flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
|
355
|
-
File.open(css, flag) do |file|
|
356
|
-
file.set_encoding(content.encoding) unless Sass::Util.ruby1_8?
|
357
|
-
file.print(content)
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
def try_delete_css(css)
|
362
|
-
return unless File.exists?(css)
|
363
|
-
run_deleting_css css
|
364
|
-
File.delete css
|
365
|
-
end
|
366
|
-
|
367
|
-
def load_paths(opts = options)
|
368
|
-
(opts[:load_paths] || []) + template_locations
|
369
|
-
end
|
370
|
-
|
371
|
-
def template_locations
|
372
|
-
template_location_array.to_a.map {|l| l.first}
|
373
|
-
end
|
374
|
-
|
375
|
-
def css_locations
|
376
|
-
template_location_array.to_a.map {|l| l.last}
|
377
|
-
end
|
378
|
-
|
379
|
-
def css_filename(name, path)
|
380
|
-
"#{path}/#{name}".gsub(/\.s[ac]ss$/, '.css')
|
381
|
-
end
|
382
|
-
end
|
383
|
-
end
|