compass-sass37 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.markdown +1 -0
- data/Rakefile +237 -0
- data/VERSION +1 -0
- data/VERSION_NAME +1 -0
- data/bin/compass +45 -0
- data/features/command_line.feature +195 -0
- data/features/extensions.feature +27 -0
- data/features/step_definitions/command_line_steps.rb +268 -0
- data/features/step_definitions/extension_steps.rb +24 -0
- data/lib/compass/actions.rb +116 -0
- data/lib/compass/app_integration/stand_alone/configuration_defaults.rb +32 -0
- data/lib/compass/app_integration/stand_alone/installer.rb +83 -0
- data/lib/compass/app_integration/stand_alone.rb +22 -0
- data/lib/compass/app_integration.rb +39 -0
- data/lib/compass/commands/base.rb +44 -0
- data/lib/compass/commands/clean_project.rb +79 -0
- data/lib/compass/commands/create_project.rb +131 -0
- data/lib/compass/commands/default.rb +50 -0
- data/lib/compass/commands/extension_command.rb +60 -0
- data/lib/compass/commands/help.rb +85 -0
- data/lib/compass/commands/imports.rb +35 -0
- data/lib/compass/commands/installer_command.rb +32 -0
- data/lib/compass/commands/interactive.rb +61 -0
- data/lib/compass/commands/list_frameworks.rb +39 -0
- data/lib/compass/commands/print_version.rb +88 -0
- data/lib/compass/commands/project_base.rb +103 -0
- data/lib/compass/commands/project_stats.rb +178 -0
- data/lib/compass/commands/project_structure.rb +93 -0
- data/lib/compass/commands/registry.rb +40 -0
- data/lib/compass/commands/sprite.rb +89 -0
- data/lib/compass/commands/stamp_pattern.rb +90 -0
- data/lib/compass/commands/unpack_extension.rb +120 -0
- data/lib/compass/commands/update_project.rb +148 -0
- data/lib/compass/commands/validate_project.rb +77 -0
- data/lib/compass/commands/watch_project.rb +117 -0
- data/lib/compass/commands/write_configuration.rb +125 -0
- data/lib/compass/commands.rb +14 -0
- data/lib/compass/compiler.rb +249 -0
- data/lib/compass/configuration/comments.rb +62 -0
- data/lib/compass/configuration/file_data.rb +21 -0
- data/lib/compass/configuration/helpers.rb +113 -0
- data/lib/compass/configuration/serialization.rb +95 -0
- data/lib/compass/dependencies.rb +12 -0
- data/lib/compass/deprecation.rb +19 -0
- data/lib/compass/errors.rb +9 -0
- data/lib/compass/exec/command_option_parser.rb +23 -0
- data/lib/compass/exec/global_options_parser.rb +59 -0
- data/lib/compass/exec/helpers.rb +21 -0
- data/lib/compass/exec/project_options_parser.rb +74 -0
- data/lib/compass/exec/sub_command_ui.rb +51 -0
- data/lib/compass/exec.rb +23 -0
- data/lib/compass/generated_version.rb +4 -0
- data/lib/compass/installers/bare_installer.rb +58 -0
- data/lib/compass/installers/base.rb +187 -0
- data/lib/compass/installers/manifest.rb +161 -0
- data/lib/compass/installers/manifest_installer.rb +61 -0
- data/lib/compass/installers/template_context.rb +44 -0
- data/lib/compass/installers.rb +3 -0
- data/lib/compass/logger.rb +140 -0
- data/lib/compass/quick_cache.rb +15 -0
- data/lib/compass/rails.rb +2 -0
- data/lib/compass/sass_compiler.rb +152 -0
- data/lib/compass/sass_extensions/functions/sprites.rb +305 -0
- data/lib/compass/sass_extensions/functions.rb +15 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +35 -0
- data/lib/compass/sass_extensions/sprites/engines.rb +25 -0
- data/lib/compass/sass_extensions/sprites/image.rb +162 -0
- data/lib/compass/sass_extensions/sprites/image_methods.rb +52 -0
- data/lib/compass/sass_extensions/sprites/image_row.rb +47 -0
- data/lib/compass/sass_extensions/sprites/images.rb +29 -0
- data/lib/compass/sass_extensions/sprites/layout/diagonal.rb +42 -0
- data/lib/compass/sass_extensions/sprites/layout/horizontal.rb +66 -0
- data/lib/compass/sass_extensions/sprites/layout/smart.rb +33 -0
- data/lib/compass/sass_extensions/sprites/layout/vertical.rb +68 -0
- data/lib/compass/sass_extensions/sprites/layout.rb +39 -0
- data/lib/compass/sass_extensions/sprites/layout_methods.rb +53 -0
- data/lib/compass/sass_extensions/sprites/row_fitter.rb +92 -0
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +93 -0
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +136 -0
- data/lib/compass/sass_extensions/sprites.rb +21 -0
- data/lib/compass/sass_extensions.rb +9 -0
- data/lib/compass/sprite_importer/binding.rb +11 -0
- data/lib/compass/sprite_importer/content.erb +87 -0
- data/lib/compass/sprite_importer.rb +117 -0
- data/lib/compass/stats.rb +99 -0
- data/lib/compass/test_case.rb +38 -0
- data/lib/compass/validator.rb +16 -0
- data/lib/compass/version.rb +42 -0
- data/lib/compass.rb +39 -0
- data/test/fixtures/extensions/only_stylesheets/compass_init.rb +1 -0
- data/test/fixtures/extensions/only_stylesheets/scss/only_stylesheets/foo.scss +3 -0
- data/test/fixtures/fonts/bgrove.base64.txt +1 -0
- data/test/fixtures/fonts/bgrove.ttf +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/ten-by-ten.gif +0 -0
- data/test/fixtures/sprites/public/images/bad_extensions/twenty-by-twenty.jpg +0 -0
- data/test/fixtures/sprites/public/images/bool/false.png +0 -0
- data/test/fixtures/sprites/public/images/bool/true.png +0 -0
- data/test/fixtures/sprites/public/images/colors/blue.png +0 -0
- data/test/fixtures/sprites/public/images/colors/yellow.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_focus.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/focus/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/large_square.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/medium.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/small.png +0 -0
- data/test/fixtures/sprites/public/images/image_row/tall.png +0 -0
- data/test/fixtures/sprites/public/images/ko/default_background.png +0 -0
- data/test/fixtures/sprites/public/images/ko/starbg26x27.png +0 -0
- data/test/fixtures/sprites/public/images/nested/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/20-by-20.png +0 -0
- data/test/fixtures/sprites/public/images/prefix/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/five.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/four.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/one.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/three.png +0 -0
- data/test/fixtures/sprites/public/images/repeat_x/two.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_active.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_hover.png +0 -0
- data/test/fixtures/sprites/public/images/selectors/ten-by-ten_target.png +0 -0
- data/test/fixtures/sprites/public/images/squares/ten-by-ten.png +0 -0
- data/test/fixtures/sprites/public/images/squares/twenty-by-twenty.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/feed.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/grid.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/fonts/sub/dk.ttf +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/busted_image_urls/config.rb +29 -0
- data/test/fixtures/stylesheets/busted_image_urls/css/screen.css +9 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/feed.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/flags/dk.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/busted_image_urls/sass/screen.sass +14 -0
- data/test/fixtures/stylesheets/compass/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/config.rb +18 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +22 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +22 -0
- data/test/fixtures/stylesheets/compass/css/appearance.css +3 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +11 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +17 -0
- data/test/fixtures/stylesheets/compass/css/border_radius.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box-sizing.css +14 -0
- data/test/fixtures/stylesheets/compass/css/box.css +103 -0
- data/test/fixtures/stylesheets/compass/css/box_shadow.css +24 -0
- data/test/fixtures/stylesheets/compass/css/brightness.css +14 -0
- data/test/fixtures/stylesheets/compass/css/browser-support.css +335 -0
- data/test/fixtures/stylesheets/compass/css/color.css +18 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +134 -0
- data/test/fixtures/stylesheets/compass/css/filters.css +53 -0
- data/test/fixtures/stylesheets/compass/css/flexbox.css +94 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +8 -0
- data/test/fixtures/stylesheets/compass/css/force-wrap.css +9 -0
- data/test/fixtures/stylesheets/compass/css/gradients.css +222 -0
- data/test/fixtures/stylesheets/compass/css/grid_background.css +79 -0
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +16 -0
- data/test/fixtures/stylesheets/compass/css/image_size.css +15 -0
- data/test/fixtures/stylesheets/compass/css/images.css +8 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +16 -0
- data/test/fixtures/stylesheets/compass/css/legacy_clearfix.css +26 -0
- data/test/fixtures/stylesheets/compass/css/lists.css +145 -0
- data/test/fixtures/stylesheets/compass/css/opacity.css +7 -0
- data/test/fixtures/stylesheets/compass/css/print.css +11 -0
- data/test/fixtures/stylesheets/compass/css/regions.css +9 -0
- data/test/fixtures/stylesheets/compass/css/replacement.css +66 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +59 -0
- data/test/fixtures/stylesheets/compass/css/selection.css +50 -0
- data/test/fixtures/stylesheets/compass/css/sprites_with_explicit_separator.css +19 -0
- data/test/fixtures/stylesheets/compass/css/stretching.css +66 -0
- data/test/fixtures/stylesheets/compass/css/support.css +116 -0
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +29 -0
- data/test/fixtures/stylesheets/compass/css/transform.css +341 -0
- data/test/fixtures/stylesheets/compass/css/transition.css +116 -0
- data/test/fixtures/stylesheets/compass/css/typography/links/hover-link.css +4 -0
- data/test/fixtures/stylesheets/compass/css/units.css +34 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +52 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +71 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +42 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_ems.css +53 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_px.css +52 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm_with_rems.css +67 -0
- data/test/fixtures/stylesheets/compass/images/100x150.gif +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpeg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.jpg +0 -0
- data/test/fixtures/stylesheets/compass/images/100x150.png +0 -0
- data/test/fixtures/stylesheets/compass/images/4x6.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ad.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ae.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/af.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ag.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ai.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/al.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/am.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/an.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ao.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ar.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/as.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/at.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/au.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/aw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ax.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/az.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ba.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/be.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/br.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/by.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/bz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ca.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/catalonia.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ch.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ci.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ck.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/co.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/cz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/de.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/do.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/dz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ec.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ee.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/eh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/england.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/er.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/es.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/et.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/europeanunion.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fam.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/fr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ga.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ge.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/gy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ht.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/hu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/id-2.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ie.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/il.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/in.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/io.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/iq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ir.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/is.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/it.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/jp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ke.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ki.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/km.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ky.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/kz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/la.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/li.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ls.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/lv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ly.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ma.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/md.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/me.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ml.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mp.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mq.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ms.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mx.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/my.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/mz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/na.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ne.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ng.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ni.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/no.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/np.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/nz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/om.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pe.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ph.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ps.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/pw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/py.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/qa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/re.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ro.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rs.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ru.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/rw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sa.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sb.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/scotland.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sd.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/se.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sh.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/si.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/so.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/st.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/sz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/td.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/th.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tj.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tk.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tl.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/to.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tr.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tv.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/tz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ua.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ug.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/um.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/us.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uy.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/uz.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/va.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vc.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ve.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vg.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vi.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vn.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/vu.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wales.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/wf.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ws.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/ye.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/yt.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/za.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zm.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag/zw.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_active.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_focus.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_hover.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states/foo_target.png +0 -0
- data/test/fixtures/stylesheets/compass/images/flag_states-sc42d7bf926.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +17 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/appearance.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/border_radius.scss +5 -0
- data/test/fixtures/stylesheets/compass/sass/box-sizing.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/box.sass +50 -0
- data/test/fixtures/stylesheets/compass/sass/box_shadow.scss +7 -0
- data/test/fixtures/stylesheets/compass/sass/brightness.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/browser-support.scss +30 -0
- data/test/fixtures/stylesheets/compass/sass/color.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +29 -0
- data/test/fixtures/stylesheets/compass/sass/filters.scss +25 -0
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +88 -0
- data/test/fixtures/stylesheets/compass/sass/fonts.sass +8 -0
- data/test/fixtures/stylesheets/compass/sass/force-wrap.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +128 -0
- data/test/fixtures/stylesheets/compass/sass/grid_background.scss +34 -0
- data/test/fixtures/stylesheets/compass/sass/hyphenation.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/image_size.sass +15 -0
- data/test/fixtures/stylesheets/compass/sass/images.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/legacy_clearfix.scss +14 -0
- data/test/fixtures/stylesheets/compass/sass/lists.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/opacity.scss +9 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/regions.scss +4 -0
- data/test/fixtures/stylesheets/compass/sass/replacement.scss +22 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +12 -0
- data/test/fixtures/stylesheets/compass/sass/selection.scss +41 -0
- data/test/fixtures/stylesheets/compass/sass/sprites_with_explicit_separator.scss +11 -0
- data/test/fixtures/stylesheets/compass/sass/stretching.sass +34 -0
- data/test/fixtures/stylesheets/compass/sass/support.scss +174 -0
- data/test/fixtures/stylesheets/compass/sass/text_shadow.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/transform.scss +87 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +21 -0
- data/test/fixtures/stylesheets/compass/sass/typography/links/hover-link.scss +3 -0
- data/test/fixtures/stylesheets/compass/sass/units.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +28 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +33 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +60 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_ems.scss +52 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_px.scss +50 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm_with_rems.scss +50 -0
- data/test/fixtures/stylesheets/envtest/config.rb +9 -0
- data/test/fixtures/stylesheets/envtest/css/env.css +10 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +19 -0
- data/test/fixtures/stylesheets/error/config.rb +10 -0
- data/test/fixtures/stylesheets/error/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/image_urls/config.rb +19 -0
- data/test/fixtures/stylesheets/image_urls/css/screen.css +5 -0
- data/test/fixtures/stylesheets/image_urls/images/grid.png +0 -0
- data/test/fixtures/stylesheets/image_urls/sass/screen.sass +8 -0
- data/test/fixtures/stylesheets/relative/assets/images/testing.png +0 -0
- data/test/fixtures/stylesheets/relative/config.rb +10 -0
- data/test/fixtures/stylesheets/relative/css/ie.css +1 -0
- data/test/fixtures/stylesheets/relative/css/print.css +1 -0
- data/test/fixtures/stylesheets/relative/css/screen.css +1 -0
- data/test/fixtures/stylesheets/relative/sass/ie.sass +5 -0
- data/test/fixtures/stylesheets/relative/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/relative/sass/screen.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/config.rb +10 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/another_simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/simple.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css +2 -0
- data/test/fixtures/stylesheets/sourcemaps/css/with_libraries.css.map +7 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/sourcemaps/sass/with_libraries.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/config.rb +25 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/ie.scss +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/print.scss +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/sass/screen.scss +6 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/ie.css +5 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/print.css +3 -0
- data/test/fixtures/stylesheets/uses_only_stylesheets_ext/stylesheets/screen.css +68 -0
- data/test/fixtures/stylesheets/valid/config.rb +9 -0
- data/test/fixtures/stylesheets/valid/sass/another_simple.scss +3 -0
- data/test/fixtures/stylesheets/valid/sass/simple.sass +2 -0
- data/test/fixtures/stylesheets/with_sass_globbing/config.rb +26 -0
- data/test/fixtures/stylesheets/with_sass_globbing/css/screen.css +19 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_1.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_2.scss +3 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/partials/_3.scss +4 -0
- data/test/fixtures/stylesheets/with_sass_globbing/sass/screen.scss +3 -0
- data/test/helpers/command_line.rb +114 -0
- data/test/helpers/diff.rb +49 -0
- data/test/helpers/io.rb +36 -0
- data/test/helpers/rails.rb +55 -0
- data/test/helpers/test_case.rb +62 -0
- data/test/integrations/compass_test.rb +259 -0
- data/test/integrations/sprites_test.rb +1123 -0
- data/test/test_helper.rb +67 -0
- data/test/units/actions_test.rb +24 -0
- data/test/units/caniuse_test.rb +194 -0
- data/test/units/command_line_test.rb +60 -0
- data/test/units/compass_util_test.rb +11 -0
- data/test/units/compiler_test.rb +16 -0
- data/test/units/configuration_test.rb +618 -0
- data/test/units/regressions_test.rb +35 -0
- data/test/units/sass_extensions_test.rb +232 -0
- data/test/units/sass_extenstions/gradients_test.rb +30 -0
- data/test/units/sprites/engine_test.rb +48 -0
- data/test/units/sprites/image_row_test.rb +58 -0
- data/test/units/sprites/image_test.rb +116 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/importer_test.rb +91 -0
- data/test/units/sprites/layout_test.rb +180 -0
- data/test/units/sprites/row_fitter_test.rb +66 -0
- data/test/units/sprites/sprite_command_test.rb +55 -0
- data/test/units/sprites/sprite_map_test.rb +169 -0
- metadata +1175 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
|
|
3
|
+
class Logger
|
|
4
|
+
|
|
5
|
+
COLORS = { :clear => 0, :red => 31, :green => 32, :yellow => 33, :blue => 34 }
|
|
6
|
+
|
|
7
|
+
ACTION_COLORS = {
|
|
8
|
+
:error => :red,
|
|
9
|
+
:warning => :yellow,
|
|
10
|
+
:info => :green,
|
|
11
|
+
:compile => :green,
|
|
12
|
+
:overwrite => :yellow,
|
|
13
|
+
:modified => :yellow,
|
|
14
|
+
:clean => :yellow,
|
|
15
|
+
:write => :green,
|
|
16
|
+
:create => :green,
|
|
17
|
+
:remove => :yellow,
|
|
18
|
+
:delete => :yellow,
|
|
19
|
+
:deleted => :yellow,
|
|
20
|
+
:created => :yellow,
|
|
21
|
+
:exists => :green,
|
|
22
|
+
:directory => :green,
|
|
23
|
+
:identical => :green,
|
|
24
|
+
:convert => :green,
|
|
25
|
+
:unchanged => :yellow
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
DEFAULT_ACTIONS = ACTION_COLORS.keys
|
|
29
|
+
|
|
30
|
+
ACTION_CAN_BE_QUIET = {
|
|
31
|
+
:error => false,
|
|
32
|
+
:warning => true,
|
|
33
|
+
:info => true,
|
|
34
|
+
:compile => true,
|
|
35
|
+
:overwrite => true,
|
|
36
|
+
:modified => true,
|
|
37
|
+
:clean => true,
|
|
38
|
+
:write => true,
|
|
39
|
+
:create => true,
|
|
40
|
+
:remove => true,
|
|
41
|
+
:delete => true,
|
|
42
|
+
:deleted => true,
|
|
43
|
+
:created => true,
|
|
44
|
+
:exists => true,
|
|
45
|
+
:directory => true,
|
|
46
|
+
:identical => true,
|
|
47
|
+
:convert => true,
|
|
48
|
+
:unchanged => true
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
attr_accessor :actions, :options, :time
|
|
52
|
+
|
|
53
|
+
def initialize(*actions)
|
|
54
|
+
self.options = actions.last.is_a?(Hash) ? actions.pop : {}
|
|
55
|
+
@actions = DEFAULT_ACTIONS.dup
|
|
56
|
+
@actions += actions
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Record an action that has occurred
|
|
60
|
+
def record(action, *arguments)
|
|
61
|
+
return if options[:quiet] && ACTION_CAN_BE_QUIET[action]
|
|
62
|
+
msg = ""
|
|
63
|
+
if time
|
|
64
|
+
msg << Time.now.strftime("%I:%M:%S.%3N %p")
|
|
65
|
+
end
|
|
66
|
+
msg << color(ACTION_COLORS[action]) if Compass.configuration.color_output
|
|
67
|
+
msg << "#{action_padding(action)}#{action}"
|
|
68
|
+
msg << color(:clear) if Compass.configuration.color_output
|
|
69
|
+
msg << " #{arguments.join(' ')}"
|
|
70
|
+
log msg
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def green
|
|
74
|
+
wrap(:green) { yield }
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def red
|
|
78
|
+
wrap(:red) { yield }
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def yellow
|
|
82
|
+
wrap(:yellow) { yield }
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def wrap(c, reset_to = :clear)
|
|
86
|
+
$stderr.write(color(c))
|
|
87
|
+
$stdout.write(color(c))
|
|
88
|
+
yield
|
|
89
|
+
ensure
|
|
90
|
+
$stderr.write(color(reset_to))
|
|
91
|
+
$stdout.write(color(reset_to))
|
|
92
|
+
$stdout.flush
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def color(c)
|
|
96
|
+
if Compass.configuration.color_output && c && COLORS.has_key?(c.to_sym)
|
|
97
|
+
if defined?($boring) && $boring
|
|
98
|
+
""
|
|
99
|
+
else
|
|
100
|
+
"\e[#{COLORS[c.to_sym]}m"
|
|
101
|
+
end
|
|
102
|
+
else
|
|
103
|
+
""
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Emit a log message without a trailing newline
|
|
108
|
+
def emit(msg)
|
|
109
|
+
print msg
|
|
110
|
+
$stdout.flush
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Emit a log message with a trailing newline
|
|
114
|
+
def log(msg)
|
|
115
|
+
puts msg
|
|
116
|
+
$stdout.flush
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# add padding to the left of an action that was performed.
|
|
120
|
+
def action_padding(action)
|
|
121
|
+
' ' * [(max_action_length - action.to_s.length), 0].max
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# the maximum length of all the actions known to the logger.
|
|
125
|
+
def max_action_length
|
|
126
|
+
@max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
class NullLogger < Logger
|
|
131
|
+
def record(*args)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def log(msg)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def emit(msg)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module QuickCache
|
|
2
|
+
|
|
3
|
+
# cache a value in memory for just a few seconds
|
|
4
|
+
# This can speed up reads of values that change relatively infrequently
|
|
5
|
+
# but might be read many times in a short burst of reads.
|
|
6
|
+
def quick_cache(key, ttl = 1)
|
|
7
|
+
@quick_cache ||= {}
|
|
8
|
+
if @quick_cache[key] && @quick_cache[key].first > Time.now - ttl
|
|
9
|
+
@quick_cache[key].last
|
|
10
|
+
else
|
|
11
|
+
(@quick_cache[key] = [Time.now, yield]).last
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
require 'sass/plugin'
|
|
2
|
+
|
|
3
|
+
class Compass::SassCompiler
|
|
4
|
+
|
|
5
|
+
include Compass::Actions
|
|
6
|
+
|
|
7
|
+
attr_writer :logger
|
|
8
|
+
attr_reader :quiet
|
|
9
|
+
attr_reader :error_count
|
|
10
|
+
attr_accessor :config
|
|
11
|
+
attr_accessor :display_compilation_times
|
|
12
|
+
attr_accessor :working_path
|
|
13
|
+
attr_accessor :only_sass_files
|
|
14
|
+
|
|
15
|
+
def initialize(options = {}, config = Compass.configuration)
|
|
16
|
+
options = options.dup
|
|
17
|
+
self.config = config
|
|
18
|
+
self.display_compilation_times = options.delete(:time)
|
|
19
|
+
self.working_path = options.delete(:working_path) || Dir.pwd
|
|
20
|
+
self.only_sass_files = options.delete(:only_sass_files) || []
|
|
21
|
+
@quiet = options[:quiet]
|
|
22
|
+
plugin_options = config.to_sass_plugin_options.merge(options)
|
|
23
|
+
if only_sass_files.any?
|
|
24
|
+
plugin_options[:template_location] = []
|
|
25
|
+
plugin_options[:load_paths] = config.sass_load_paths
|
|
26
|
+
end
|
|
27
|
+
plugin_options[:always_update] = true if options.delete(:force)
|
|
28
|
+
plugin_options[:compass] ||= {}
|
|
29
|
+
plugin_options[:compass][:logger] = logger
|
|
30
|
+
@compiler = Sass::Plugin::Compiler.new(plugin_options)
|
|
31
|
+
@start_times = {}
|
|
32
|
+
@error_count = 0
|
|
33
|
+
|
|
34
|
+
public_methods(true).grep(/^when_/).each do |callback|
|
|
35
|
+
@compiler.send(callback.to_s.sub(/^when_/, 'on_')) {|*args| send(callback, *args) }
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def compile!
|
|
40
|
+
@compiler.update_stylesheets(individual_files)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def watch!(options = {}, &block)
|
|
44
|
+
skip_initial_update = options.fetch(:skip_initial_update, false)
|
|
45
|
+
begin
|
|
46
|
+
@compiler.watch(individual_files, options.merge(:skip_initial_update => skip_initial_update), &block)
|
|
47
|
+
rescue Sass::SyntaxError => e
|
|
48
|
+
skip_initial_update = true
|
|
49
|
+
retry
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def individual_files
|
|
54
|
+
only_sass_files.map {|sass_file| [sass_file, corresponding_css_file(sass_file)]}
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def clean!
|
|
58
|
+
@compiler.clean(individual_files)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def file_list
|
|
62
|
+
@compiler.file_list(individual_files)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def when_updating_stylesheets(individual_files)
|
|
66
|
+
@start_times = {}
|
|
67
|
+
@error_count = 0
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def when_compilation_starting(sass_file, css, sourcemap)
|
|
71
|
+
@start_times[sass_file] = Time.now
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def when_template_created(sass_file)
|
|
75
|
+
logger.record :created, relativize(sass_file)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def when_template_deleted(sass_file)
|
|
79
|
+
logger.record :deleted, relativize(sass_file)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def when_template_modified(sass_file)
|
|
83
|
+
logger.record :modified, relativize(sass_file)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def when_updated_stylesheet(sass_file, css, sourcemap)
|
|
87
|
+
if css && display_compilation_times && @start_times[sass_file]
|
|
88
|
+
duration = ((Time.now - @start_times[sass_file]) * 1000).round / 1000.0
|
|
89
|
+
logger.record :write, "#{relativize(css)} (#{duration}s)"
|
|
90
|
+
else
|
|
91
|
+
logger.record :write, relativize(css) if css
|
|
92
|
+
end
|
|
93
|
+
config.run_stylesheet_saved(css) if css
|
|
94
|
+
|
|
95
|
+
logger.record :write, relativize(sourcemap) if sourcemap
|
|
96
|
+
config.run_sourcemap_saved(sourcemap) if sourcemap
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def when_creating_directory(dirname)
|
|
100
|
+
logger.record :directory, relativize(dirname)
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def when_deleting_css(filename)
|
|
104
|
+
logger.record :delete, relativize(filename)
|
|
105
|
+
config.run_stylesheet_removed(filename) if filename
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def when_deleting_sourcemap(filename)
|
|
109
|
+
logger.record :delete, relativize(filename)
|
|
110
|
+
config.run_sourcemap_removed(filename) if filename
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def when_compilation_error(error, sass_file, css_file, sourcemap_file)
|
|
114
|
+
@error_count += 1
|
|
115
|
+
if error.respond_to?(:sass_filename)
|
|
116
|
+
error_filename = error.sass_filename || sass_file
|
|
117
|
+
if relativize(error_filename) == relativize(sass_file)
|
|
118
|
+
logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line}: #{error.message})"
|
|
119
|
+
else
|
|
120
|
+
logger.record :error, "#{relativize(sass_file)} (Line #{error.sass_line} of #{relativize(error_filename)}: #{error.message})"
|
|
121
|
+
end
|
|
122
|
+
else
|
|
123
|
+
logger.record :error, "#{relativize(sass_file)} (#{error.backtrace.first}: #{error.message})"
|
|
124
|
+
end
|
|
125
|
+
config.run_stylesheet_error(sass_file, error.message)
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def logger
|
|
129
|
+
@logger ||= Compass::Logger.new(:quiet => quiet)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def corresponding_css_file(sass_file)
|
|
133
|
+
"#{config.css_path}/#{stylesheet_name(sass_file)}.css"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def stylesheet_name(sass_file)
|
|
137
|
+
if sass_file.index(config.sass_path) == 0
|
|
138
|
+
sass_file[(config.sass_path.length + 1)..-6].sub(/\.css$/,'')
|
|
139
|
+
else
|
|
140
|
+
raise Compass::Error, "Individual stylesheets must be in the sass directory."
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def sass_files(options = {})
|
|
145
|
+
@compiler.template_location_array.map do |(sass_dir, css_dir)|
|
|
146
|
+
glob = options[:include_partials] ?
|
|
147
|
+
File.join("**","*.s[ac]ss*") :
|
|
148
|
+
File.join("**","[^_]*.s[ac]ss*")
|
|
149
|
+
Dir.glob(File.join(sass_dir, glob))
|
|
150
|
+
end.flatten
|
|
151
|
+
end
|
|
152
|
+
end
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
module Compass::SassExtensions::Functions::Sprites
|
|
2
|
+
|
|
3
|
+
extend Compass::SassExtensions::Functions::SassDeclarationHelper
|
|
4
|
+
extend Sass::Script::Value::Helpers
|
|
5
|
+
include Sass::Script::Value::Helpers
|
|
6
|
+
|
|
7
|
+
ZERO = number(0)
|
|
8
|
+
BOOL_FALSE = bool(false)
|
|
9
|
+
VALID_SELECTORS = %w(hover active target focus)
|
|
10
|
+
|
|
11
|
+
# Provides a consistent interface for getting a variable in ruby
|
|
12
|
+
# from a keyword argument hash that accounts for underscores/dash equivalence
|
|
13
|
+
# and allows the caller to pass a symbol instead of a string.
|
|
14
|
+
module VariableReader
|
|
15
|
+
def get_var(variable_name)
|
|
16
|
+
self[variable_name.to_s.gsub(/-/,"_")]
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Returns the width of the generated sprite map
|
|
21
|
+
def sprite_width(map, sprite=nil)
|
|
22
|
+
verify_map(map, 'sprite-width')
|
|
23
|
+
file = get_sprite_file(map, sprite)
|
|
24
|
+
width, _ = image_dimensions(file)
|
|
25
|
+
number(width, "px")
|
|
26
|
+
end
|
|
27
|
+
declare :sprite_width, [:map]
|
|
28
|
+
declare :sprite_width, [:map, :sprite]
|
|
29
|
+
|
|
30
|
+
# Returns the height of the generated sprite map
|
|
31
|
+
def sprite_height(map, sprite=nil)
|
|
32
|
+
verify_map(map, 'sprite-height')
|
|
33
|
+
file = get_sprite_file(map, sprite)
|
|
34
|
+
_, height = image_dimensions(file)
|
|
35
|
+
number(height, "px")
|
|
36
|
+
end
|
|
37
|
+
declare :sprite_height, [:map]
|
|
38
|
+
declare :sprite_height, [:map, :sprite]
|
|
39
|
+
|
|
40
|
+
# Returns a list of all sprite names
|
|
41
|
+
def sprite_names(map)
|
|
42
|
+
verify_map(map, 'sprite-names')
|
|
43
|
+
list(map.sprite_names.map { |f| identifier(f) }, :comma)
|
|
44
|
+
end
|
|
45
|
+
declare :sprite_names, [:map]
|
|
46
|
+
|
|
47
|
+
# Returns the system path of the sprite file
|
|
48
|
+
def sprite_path(map)
|
|
49
|
+
verify_map(map, 'sprite-path')
|
|
50
|
+
identifier(map.filename)
|
|
51
|
+
end
|
|
52
|
+
declare :sprite_path, [:map]
|
|
53
|
+
|
|
54
|
+
# Returns the sprite file as an inline image
|
|
55
|
+
# @include "icon/*.png";
|
|
56
|
+
# #{$icon-sprite-base-class} {
|
|
57
|
+
# background-image: inline-sprite($icon-sprites);
|
|
58
|
+
# }
|
|
59
|
+
def inline_sprite(map)
|
|
60
|
+
verify_map(map, "sprite-url")
|
|
61
|
+
map.generate
|
|
62
|
+
path = map.filename
|
|
63
|
+
inline_image_string(data(path), compute_mime_type(path))
|
|
64
|
+
end
|
|
65
|
+
declare :inline_sprite, [:map]
|
|
66
|
+
|
|
67
|
+
# Creates a Compass::SassExtensions::Sprites::SpriteMap object. A sprite map, when used in a property is the same
|
|
68
|
+
# as calling sprite-url. So the following background properties are equivalent:
|
|
69
|
+
#
|
|
70
|
+
# $icons: sprite-map("icons/*.png");
|
|
71
|
+
# background: sprite-url($icons) no-repeat;
|
|
72
|
+
# background: $icons no-repeat;
|
|
73
|
+
#
|
|
74
|
+
# The sprite map object will generate the sprite map image, if necessary,
|
|
75
|
+
# the first time it is converted to a url. Simply constructing it has no side-effects.
|
|
76
|
+
def sprite_map(glob, kwargs = {})
|
|
77
|
+
kwargs.extend VariableReader
|
|
78
|
+
Compass::SassExtensions::Sprites::SpriteMap.from_uri(glob, self, kwargs)
|
|
79
|
+
end
|
|
80
|
+
declare :sprite_map, [:glob], :var_kwargs => true
|
|
81
|
+
|
|
82
|
+
# Returns the image and background position for use in a single shorthand property:
|
|
83
|
+
#
|
|
84
|
+
# $icons: sprite-map("icons/*.png"); // contains icons/new.png among others.
|
|
85
|
+
# background: sprite($icons, new) no-repeat;
|
|
86
|
+
#
|
|
87
|
+
# Becomes:
|
|
88
|
+
#
|
|
89
|
+
# background: url('/images/icons.png?12345678') 0 -24px no-repeat;
|
|
90
|
+
#
|
|
91
|
+
# If the `use_percentages` parameter is passed as true, percentages will be
|
|
92
|
+
# used to position the sprite. Example output:
|
|
93
|
+
#
|
|
94
|
+
# background: url('/images/icons.png?12345678') 0 50% no-repeat;
|
|
95
|
+
#
|
|
96
|
+
def sprite(map, sprite, offset_x = ZERO, offset_y = ZERO, use_percentages = BOOL_FALSE)
|
|
97
|
+
sprite = convert_sprite_name(sprite)
|
|
98
|
+
verify_map(map)
|
|
99
|
+
verify_sprite(sprite)
|
|
100
|
+
url = sprite_url(map)
|
|
101
|
+
position = sprite_position(map, sprite, offset_x, offset_y, use_percentages)
|
|
102
|
+
list([url] + position.value, :space)
|
|
103
|
+
end
|
|
104
|
+
declare :sprite, [:map, :sprite]
|
|
105
|
+
declare :sprite, [:map, :sprite, :offset_x]
|
|
106
|
+
declare :sprite, [:map, :sprite, :offset_x, :offset_y]
|
|
107
|
+
declare :sprite, [:map, :sprite, :offset_x, :offset_y, :use_percentages]
|
|
108
|
+
|
|
109
|
+
# Returns the name of a sprite map
|
|
110
|
+
# The name is derived from the folder than contains the sprites.
|
|
111
|
+
def sprite_map_name(map)
|
|
112
|
+
verify_map(map, "sprite-map-name")
|
|
113
|
+
identifier(map.name)
|
|
114
|
+
end
|
|
115
|
+
declare :sprite_name, [:sprite]
|
|
116
|
+
|
|
117
|
+
# Returns the path to the original image file for the sprite with the given name
|
|
118
|
+
def sprite_file(map, sprite)
|
|
119
|
+
sprite = convert_sprite_name(sprite)
|
|
120
|
+
verify_map(map, "sprite")
|
|
121
|
+
verify_sprite(sprite)
|
|
122
|
+
if image = map.image_for(sprite.value)
|
|
123
|
+
image_path = Pathname.new(File.expand_path(image.file))
|
|
124
|
+
images_path = Pathname.new(File.expand_path(Compass.configuration.images_path))
|
|
125
|
+
quoted_string(image_path.relative_path_from(images_path).to_s)
|
|
126
|
+
else
|
|
127
|
+
missing_image!(map, sprite)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
declare :sprite_file, [:map, :sprite]
|
|
131
|
+
|
|
132
|
+
# Returns boolean if sprite has a parent
|
|
133
|
+
def sprite_does_not_have_parent(map, sprite)
|
|
134
|
+
sprite = convert_sprite_name(sprite)
|
|
135
|
+
verify_map map
|
|
136
|
+
verify_sprite sprite
|
|
137
|
+
bool(map.image_for(sprite.value).parent.nil?)
|
|
138
|
+
end
|
|
139
|
+
declare :sprite_does_not_have_parent, [:map, :sprite]
|
|
140
|
+
|
|
141
|
+
#return the name of the selector file
|
|
142
|
+
def sprite_selector_file(map, sprite, selector)
|
|
143
|
+
sprite = convert_sprite_name(sprite)
|
|
144
|
+
image = map.image_for(sprite)
|
|
145
|
+
if map.send(:"has_#{selector.value}?", sprite.value)
|
|
146
|
+
return identifier(image.send(selector.value).name)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
raise Sass::SyntaxError, "Sprite: #{sprite.value} does not have a #{selector} state"
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
declare :sprite_selector_file, [:map, :sprite, :selector]
|
|
153
|
+
|
|
154
|
+
# Returns boolean if sprite has the selector
|
|
155
|
+
def sprite_has_selector(map, sprite, selector)
|
|
156
|
+
sprite = convert_sprite_name(sprite)
|
|
157
|
+
verify_map map
|
|
158
|
+
verify_sprite sprite
|
|
159
|
+
unless VALID_SELECTORS.include?(selector.value)
|
|
160
|
+
raise Sass::SyntaxError, "Invalid Selctor did you mean one of: #{VALID_SELECTORS.join(', ')}"
|
|
161
|
+
end
|
|
162
|
+
bool map.send(:"has_#{selector.value}?", sprite.value)
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
declare :sprite_has_selector, [:map, :sprite, :selector]
|
|
166
|
+
|
|
167
|
+
# Determines if the CSS selector is valid
|
|
168
|
+
IDENTIFIER_RX = /\A#{Sass::SCSS::RX::IDENT}\Z/
|
|
169
|
+
def sprite_has_valid_selector(selector)
|
|
170
|
+
unless selector.value =~ IDENTIFIER_RX
|
|
171
|
+
raise Sass::SyntaxError, "#{selector} must be a legal css identifier"
|
|
172
|
+
end
|
|
173
|
+
bool true
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
# Returns a url to the sprite image.
|
|
177
|
+
def sprite_url(map)
|
|
178
|
+
verify_map(map, "sprite-url")
|
|
179
|
+
map.generate
|
|
180
|
+
generated_image_url(identifier("#{map.path}-s#{map.uniqueness_hash}.png"))
|
|
181
|
+
end
|
|
182
|
+
declare :sprite_url, [:map]
|
|
183
|
+
|
|
184
|
+
# Returns the position for the original image in the sprite.
|
|
185
|
+
# This is suitable for use as a value to background-position:
|
|
186
|
+
#
|
|
187
|
+
# $icons: sprite-map("icons/*.png");
|
|
188
|
+
# background-position: sprite-position($icons, new);
|
|
189
|
+
#
|
|
190
|
+
# Might generate something like:
|
|
191
|
+
#
|
|
192
|
+
# background-position: 0 -34px;
|
|
193
|
+
#
|
|
194
|
+
# You can adjust the background relative to this position by passing values for
|
|
195
|
+
# `$offset-x` and `$offset-y`:
|
|
196
|
+
#
|
|
197
|
+
# $icons: sprite-map("icons/*.png");
|
|
198
|
+
# background-position: sprite-position($icons, new, 3px, -2px);
|
|
199
|
+
#
|
|
200
|
+
# Would change the above output to:
|
|
201
|
+
#
|
|
202
|
+
# background-position: 3px -36px;
|
|
203
|
+
#
|
|
204
|
+
# If you set the `use_percentages` parameter to true, the position will be
|
|
205
|
+
# expressed in percentages. An example:
|
|
206
|
+
#
|
|
207
|
+
# background-position: sprite-position($icons, new, 0, 0, true);
|
|
208
|
+
#
|
|
209
|
+
# Would result in something like this:
|
|
210
|
+
#
|
|
211
|
+
# background-position: 0 42%;
|
|
212
|
+
#
|
|
213
|
+
def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO, use_percentages = BOOL_FALSE)
|
|
214
|
+
assert_type offset_x, :Number
|
|
215
|
+
assert_type offset_y, :Number
|
|
216
|
+
sprite = convert_sprite_name(sprite)
|
|
217
|
+
verify_map(map, "sprite-position")
|
|
218
|
+
unless sprite.is_a?(Sass::Script::Value::String) || sprite.is_a?(Sass::Script::Value::Number)
|
|
219
|
+
raise Sass::SyntaxError, %Q(The second argument to sprite-position must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.)
|
|
220
|
+
end
|
|
221
|
+
image = map.image_for(sprite.value)
|
|
222
|
+
unless image
|
|
223
|
+
missing_image!(map, sprite)
|
|
224
|
+
end
|
|
225
|
+
if use_percentages.value
|
|
226
|
+
xdivis = map.width - image.width;
|
|
227
|
+
x = (offset_x.value + image.left.to_f) / (xdivis.nonzero? || 1) * 100
|
|
228
|
+
x = x == 0 ? number(x) : number(x, "%")
|
|
229
|
+
ydivis = map.height - image.height;
|
|
230
|
+
y = (offset_y.value + image.top.to_f) / (ydivis.nonzero? || 1) * 100
|
|
231
|
+
y = y == 0 ? number(y) : number(y, "%")
|
|
232
|
+
else
|
|
233
|
+
if offset_x.unit_str == "%"
|
|
234
|
+
x = offset_x # CE: Shouldn't this be a percentage of the total width?
|
|
235
|
+
else
|
|
236
|
+
x = offset_x.value - image.left
|
|
237
|
+
x = x == 0 ? number(x) : number(x, "px")
|
|
238
|
+
end
|
|
239
|
+
y = offset_y.value - image.top
|
|
240
|
+
y = y == 0 ? number(y) : number(y, "px")
|
|
241
|
+
end
|
|
242
|
+
list(x, y, :space)
|
|
243
|
+
end
|
|
244
|
+
declare :sprite_position, [:map]
|
|
245
|
+
declare :sprite_position, [:map, :sprite]
|
|
246
|
+
declare :sprite_position, [:map, :sprite, :offset_x]
|
|
247
|
+
declare :sprite_position, [:map, :sprite, :offset_x, :offset_y]
|
|
248
|
+
declare :sprite_position, [:map, :sprite, :offset_x, :offset_y, :use_percentages]
|
|
249
|
+
|
|
250
|
+
protected
|
|
251
|
+
|
|
252
|
+
def get_sprite_file(map, sprite=nil)
|
|
253
|
+
if sprite
|
|
254
|
+
map.image_for(sprite).file
|
|
255
|
+
else
|
|
256
|
+
map.filename
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
def reversed_color_names
|
|
261
|
+
if Sass::Script::Value::Color.const_defined?(:HTML4_COLORS_REVERSE)
|
|
262
|
+
Sass::Script::Value::Color::HTML4_COLORS_REVERSE
|
|
263
|
+
else
|
|
264
|
+
Sass::Script::Value::Color::COLOR_NAMES_REVERSE
|
|
265
|
+
end
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
def convert_sprite_name(sprite)
|
|
269
|
+
case sprite
|
|
270
|
+
when Sass::Script::Value::Color
|
|
271
|
+
rgb = if reversed_color_names.keys.first.size == 3
|
|
272
|
+
sprite.rgb
|
|
273
|
+
else
|
|
274
|
+
# Sass 3.3 includes the alpha channel
|
|
275
|
+
sprite.rgba
|
|
276
|
+
end
|
|
277
|
+
identifier(reversed_color_names[rgb])
|
|
278
|
+
when Sass::Script::Value::Bool
|
|
279
|
+
identifier(sprite.to_s)
|
|
280
|
+
else
|
|
281
|
+
sprite
|
|
282
|
+
end
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def verify_map(map, error = "sprite")
|
|
286
|
+
unless map.is_a?(Compass::SassExtensions::Sprites::SpriteMap)
|
|
287
|
+
missing_sprite!(error)
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
|
|
291
|
+
def verify_sprite(sprite)
|
|
292
|
+
unless sprite.is_a?(Sass::Script::Value::String) || sprite.is_a?(Sass::Script::Value::Number)
|
|
293
|
+
raise Sass::SyntaxError, %Q(The second argument to sprite() must be a sprite name. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.)
|
|
294
|
+
end
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
def missing_image!(map, sprite)
|
|
298
|
+
raise Sass::SyntaxError, "No sprite called #{sprite} found in sprite map #{map.path}/#{map.name}. Did you mean one of: #{map.sprite_names.join(", ")}"
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def missing_sprite!(function_name)
|
|
302
|
+
raise Sass::SyntaxError, %Q(The first argument to #{function_name}() must be a sprite map. See http://beta.compass-style.org/help/tutorials/spriting/ for more information.)
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module Compass::SassExtensions::Functions
|
|
2
|
+
module SassDeclarationHelper
|
|
3
|
+
def declare(*args)
|
|
4
|
+
Sass::Script::Functions.declare(*args)
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
%w(sprites).each do |func|
|
|
10
|
+
require "compass/sass_extensions/functions/#{func}"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module Sass::Script::Functions
|
|
14
|
+
include Compass::SassExtensions::Functions::Sprites
|
|
15
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'oily_png'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
require 'chunky_png'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
module Compass
|
|
8
|
+
module SassExtensions
|
|
9
|
+
module Sprites
|
|
10
|
+
class ChunkyPngEngine < Compass::SassExtensions::Sprites::Engine
|
|
11
|
+
|
|
12
|
+
def construct_sprite
|
|
13
|
+
@canvas = ChunkyPNG::Image.new(width, height, ChunkyPNG::Color::TRANSPARENT)
|
|
14
|
+
images.each do |image|
|
|
15
|
+
input_png = begin
|
|
16
|
+
ChunkyPNG::Image.from_file(image.file)
|
|
17
|
+
rescue ChunkyPNG::SignatureMismatch
|
|
18
|
+
raise Compass::SpriteException, "You have provided a file that does not have a PNG signature. Only PNG files are supported by the default sprite engine"
|
|
19
|
+
end
|
|
20
|
+
canvas.replace! input_png, image.left, image.top
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def save(filename)
|
|
25
|
+
if canvas.nil?
|
|
26
|
+
construct_sprite
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
canvas.save(filename, Compass.configuration.chunky_png_options)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
class Engine
|
|
5
|
+
attr_accessor :width, :height, :images, :canvas
|
|
6
|
+
def initialize(width, height, images)
|
|
7
|
+
@width, @height, @images = width, height, images
|
|
8
|
+
@canvas = nil
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def construct_sprite
|
|
12
|
+
raise ::Compass::Error, "You must implement construct_sprite"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def save(filename)
|
|
16
|
+
raise ::Compass::Error, "You must implement save(filename)"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
require 'compass/sass_extensions/sprites/engines/chunky_png_engine'
|