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,162 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
class Image
|
|
5
|
+
include Sass::Script::Value::Helpers
|
|
6
|
+
ACTIVE = %r{[_-]active$}
|
|
7
|
+
TARGET = %r{[_-]target$}
|
|
8
|
+
HOVER = %r{[_-]hover$}
|
|
9
|
+
FOCUS = %r{[_-]focus$}
|
|
10
|
+
PARENT = %r{(.+)[-_](.+)$}
|
|
11
|
+
|
|
12
|
+
REPEAT_X = 'repeat-x'
|
|
13
|
+
REPEAT_Y = 'repeat-y'
|
|
14
|
+
NO_REPEAT = 'no-repeat'
|
|
15
|
+
|
|
16
|
+
VALID_REPEATS = [REPEAT_Y, REPEAT_X, NO_REPEAT]
|
|
17
|
+
|
|
18
|
+
attr_reader :relative_file, :options, :base, :name
|
|
19
|
+
attr_accessor :top, :left
|
|
20
|
+
|
|
21
|
+
def initialize(base, relative_file, options)
|
|
22
|
+
@base, @relative_file, @options = base, relative_file, options
|
|
23
|
+
@left = @top = 0
|
|
24
|
+
@name = File.basename(relative_file, '.png')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# The Full path to the image
|
|
28
|
+
def file
|
|
29
|
+
@file ||= find_file
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def find_file
|
|
33
|
+
Compass.configuration.sprite_load_path.compact.each do |path|
|
|
34
|
+
f = File.join(path, relative_file)
|
|
35
|
+
if File.exist?(f)
|
|
36
|
+
return f
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Width of the image
|
|
42
|
+
def width
|
|
43
|
+
dimensions.first
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def size
|
|
47
|
+
@size ||= File.size(file)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Height of the image
|
|
51
|
+
def height
|
|
52
|
+
dimensions.last
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def get_var_file(var)
|
|
56
|
+
options.get_var "#{base.name}_#{name}_#{var}"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Value of <tt> $#{name}-repeat </tt> or <tt> $repeat </tt>
|
|
60
|
+
def repeat
|
|
61
|
+
@repeat ||= begin
|
|
62
|
+
rep = (get_var_file("repeat") || options.get_var("repeat") || identifier(NO_REPEAT)).value
|
|
63
|
+
unless VALID_REPEATS.include? rep
|
|
64
|
+
raise SpriteException, "Invalid option for repeat \"#{rep}\" - valid options are #{VALID_REPEATS.join(', ')}"
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
rep
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def repeat_x?
|
|
72
|
+
repeat == REPEAT_X
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def repeat_y?
|
|
76
|
+
repeat == REPEAT_Y
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def no_repeat?
|
|
80
|
+
repeat == NO_REPEAT
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# Value of <tt> $#{name}-position </tt> or <tt> $position </tt> defaults to <tt>0px</tt>
|
|
84
|
+
def position
|
|
85
|
+
@position ||= get_var_file("position") || options.get_var("position") || number(0, "px")
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Offset within the sprite
|
|
89
|
+
def offset
|
|
90
|
+
@offset ||= (position.unitless? || position.unit_str == "px") ? position.value : 0
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Spacing between this image and the next
|
|
94
|
+
def spacing
|
|
95
|
+
@spacing ||= (get_var_file("spacing") || options.get_var("spacing") || number(0, 'px')).value
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# MD5 hash of this file
|
|
99
|
+
def digest
|
|
100
|
+
Digest::MD5.file(file).hexdigest
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
# mtime of this file
|
|
104
|
+
def mtime
|
|
105
|
+
File.mtime(file)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Is hover selector
|
|
109
|
+
def hover?
|
|
110
|
+
name =~ HOVER
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Hover selector Image object if exsists
|
|
114
|
+
def hover
|
|
115
|
+
base.get_magic_selector_image(name, 'hover')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Is target selector
|
|
119
|
+
def target?
|
|
120
|
+
name =~ TARGET
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Target selector Image object if exsists
|
|
124
|
+
def target
|
|
125
|
+
base.get_magic_selector_image(name, 'target')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
# Is active selector
|
|
129
|
+
def active?
|
|
130
|
+
name =~ ACTIVE
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
# Active selector Image object if exsists
|
|
134
|
+
def active
|
|
135
|
+
base.get_magic_selector_image(name, 'active')
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Is active selector
|
|
139
|
+
def focus?
|
|
140
|
+
name =~ FOCUS
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Active selector Image object if exsists
|
|
144
|
+
def focus
|
|
145
|
+
base.get_magic_selector_image(name, 'focus')
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def parent
|
|
149
|
+
if [hover?, target?, active?, focus?].any?
|
|
150
|
+
PARENT.match name
|
|
151
|
+
base.image_for($1)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
private
|
|
156
|
+
def dimensions
|
|
157
|
+
@dimensions ||= Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties.new(file).size
|
|
158
|
+
end
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module ImageMethods
|
|
5
|
+
# Fetches the Sprite::Image object for the supplied name
|
|
6
|
+
def image_for(name)
|
|
7
|
+
if name.is_a?(Sass::Script::Value::String)
|
|
8
|
+
name = name.value
|
|
9
|
+
end
|
|
10
|
+
name = name.to_s
|
|
11
|
+
@images.detect { |img| img.name.downcase == name.downcase}
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Returns true if the image name has a hover selector image
|
|
15
|
+
def has_hover?(name)
|
|
16
|
+
!get_magic_selector_image(name, 'hover').nil?
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns true if the image name has a target selector image
|
|
20
|
+
def has_target?(name)
|
|
21
|
+
!get_magic_selector_image(name, 'target').nil?
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Returns true if the image name has a focus selector image
|
|
25
|
+
def has_focus?(name)
|
|
26
|
+
!get_magic_selector_image(name, 'focus').nil?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns true if the image name has an active selector image
|
|
30
|
+
def has_active?(name)
|
|
31
|
+
!get_magic_selector_image(name, 'active').nil?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
SEPERATORS = ['_', '-']
|
|
35
|
+
|
|
36
|
+
def get_magic_selector_image(name, selector)
|
|
37
|
+
SEPERATORS.each do |seperator|
|
|
38
|
+
file = image_for("#{name}#{seperator}#{selector}")
|
|
39
|
+
return file if !file.nil?
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
nil
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Return and array of image names that make up this sprite
|
|
46
|
+
def sprite_names
|
|
47
|
+
image_names.map { |f| File.basename(f, '.png') }
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require 'forwardable'
|
|
2
|
+
|
|
3
|
+
module Compass
|
|
4
|
+
module SassExtensions
|
|
5
|
+
module Sprites
|
|
6
|
+
class ImageRow
|
|
7
|
+
extend Forwardable
|
|
8
|
+
|
|
9
|
+
attr_reader :images, :max_width
|
|
10
|
+
def_delegators :@images, :last, :delete, :empty?, :length
|
|
11
|
+
|
|
12
|
+
def initialize(max_width)
|
|
13
|
+
@images = []
|
|
14
|
+
@max_width = max_width
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def add(image)
|
|
18
|
+
return false if !will_fit?(image)
|
|
19
|
+
@images << image
|
|
20
|
+
true
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
alias :<< :add
|
|
24
|
+
|
|
25
|
+
def height
|
|
26
|
+
images.map(&:height).max
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def width
|
|
30
|
+
images.map(&:width).max
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def total_width
|
|
34
|
+
images.inject(0) {|sum, img| sum + img.width }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def efficiency
|
|
38
|
+
1 - (total_width.to_f / max_width.to_f)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def will_fit?(image)
|
|
42
|
+
(total_width + image.width) <= max_width
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
class Images < Array
|
|
5
|
+
|
|
6
|
+
def sort_by!(method)
|
|
7
|
+
invert = false
|
|
8
|
+
if method.to_s[0] == '!'[0] # have todo this for 1.8.7 compat
|
|
9
|
+
method = method.to_s[1..-1]
|
|
10
|
+
invert = true
|
|
11
|
+
end
|
|
12
|
+
method = method.to_sym
|
|
13
|
+
self.sort! do |a, b|
|
|
14
|
+
unless a.send(method) == b.send(method)
|
|
15
|
+
a.send(method) <=> b.send(method)
|
|
16
|
+
else
|
|
17
|
+
other = ([:size, :name] - [method]).first
|
|
18
|
+
a.send(other) <=> b.send(other)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
self.reverse! if invert
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module Layout
|
|
5
|
+
class Diagonal < SpriteLayout
|
|
6
|
+
|
|
7
|
+
def layout!
|
|
8
|
+
calculate_width!
|
|
9
|
+
calculate_height!
|
|
10
|
+
calculate_positions!
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
private # ===========================================================================================>
|
|
14
|
+
|
|
15
|
+
def calculate_width!
|
|
16
|
+
@width = @images.inject(0) {|sum, img| sum + img.width}
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def calculate_height!
|
|
20
|
+
@height = @images.inject(0) {|sum, img| sum + img.height}
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def calculate_positions!
|
|
24
|
+
previous = nil
|
|
25
|
+
@images.each_with_index do |image, index|
|
|
26
|
+
if previous.nil?
|
|
27
|
+
previous = image
|
|
28
|
+
image.top = @height - image.height
|
|
29
|
+
image.left = 0
|
|
30
|
+
next
|
|
31
|
+
end
|
|
32
|
+
image.top = previous.top - image.height
|
|
33
|
+
image.left = previous.left + previous.width
|
|
34
|
+
previous = image
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module Layout
|
|
5
|
+
class Horizontal < SpriteLayout
|
|
6
|
+
|
|
7
|
+
def layout!
|
|
8
|
+
calculate_height!
|
|
9
|
+
calculate_width!
|
|
10
|
+
calculate_positions!
|
|
11
|
+
tile_images_that_repeat!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private # ===========================================================================================>
|
|
15
|
+
|
|
16
|
+
def calculate_height!
|
|
17
|
+
@height = @images.map {|image| image.height + image.offset}.max
|
|
18
|
+
if repeating_images?
|
|
19
|
+
calculate_repeat_extra_height!
|
|
20
|
+
end
|
|
21
|
+
@height
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def calculate_width!
|
|
25
|
+
@width = @images.inject(0) { |sum, image| sum += (image.width + image.spacing) }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def repeating_images?
|
|
29
|
+
@repeating_images ||= @images.any?(&:repeat_y?)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def calculate_repeat_extra_height!
|
|
33
|
+
m = @images.inject(1) {|m,img| img.repeat_y? ? m.lcm(img.height) : m }
|
|
34
|
+
remainder = @height % m
|
|
35
|
+
@height += (m - remainder) unless remainder.zero?
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def calculate_positions!
|
|
39
|
+
@images.each_with_index do |image, index|
|
|
40
|
+
image.top = image.position.unit_str == '%' ? (@height - image.height) * (image.position.value / 100.0) : image.position.value
|
|
41
|
+
next if index == 0
|
|
42
|
+
last_image = @images[index-1]
|
|
43
|
+
image.left = last_image.left + last_image.width + [image.spacing, last_image.spacing].max
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def tile_images_that_repeat!
|
|
48
|
+
return unless repeating_images?
|
|
49
|
+
@images.map {|img| img if img.repeat_y?}.compact.each do |image|
|
|
50
|
+
y = (image.top + image.height)
|
|
51
|
+
while y < @height do
|
|
52
|
+
begin
|
|
53
|
+
img = image.dup
|
|
54
|
+
img.top = y.to_i
|
|
55
|
+
@images << img
|
|
56
|
+
y += image.height
|
|
57
|
+
end
|
|
58
|
+
end #while
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module Layout
|
|
5
|
+
class Smart < SpriteLayout
|
|
6
|
+
|
|
7
|
+
def layout!
|
|
8
|
+
calculate_positions!
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private # ===========================================================================================>
|
|
12
|
+
|
|
13
|
+
def calculate_positions!
|
|
14
|
+
fitter = ::Compass::SassExtensions::Sprites::RowFitter.new(@images)
|
|
15
|
+
current_y = 0
|
|
16
|
+
fitter.fit!.each do |row|
|
|
17
|
+
current_x = 0
|
|
18
|
+
row.images.each_with_index do |image, index|
|
|
19
|
+
image.left = current_x
|
|
20
|
+
image.top = current_y
|
|
21
|
+
current_x += image.width
|
|
22
|
+
end
|
|
23
|
+
current_y += row.height
|
|
24
|
+
end
|
|
25
|
+
@width = fitter.width
|
|
26
|
+
@height = fitter.height
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module Layout
|
|
5
|
+
class Vertical < SpriteLayout
|
|
6
|
+
|
|
7
|
+
def layout!
|
|
8
|
+
calculate_width!
|
|
9
|
+
calculate_positions!
|
|
10
|
+
calculate_height!
|
|
11
|
+
tile_images_that_repeat!
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
private # ===========================================================================================>
|
|
15
|
+
|
|
16
|
+
def calculate_width!
|
|
17
|
+
@width = @images.map { |image| image.width + image.offset }.max
|
|
18
|
+
if repeating_images?
|
|
19
|
+
calculate_repeat_extra_width!
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
@width
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def calculate_height!
|
|
26
|
+
last = @images.last
|
|
27
|
+
@height = last.top + last.height
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def repeating_images?
|
|
31
|
+
@repeating_images ||= @images.any?(&:repeat_x?)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def calculate_repeat_extra_width!
|
|
35
|
+
m = @images.inject(1) {|m,img| img.repeat_x? ? m.lcm(img.width) : m }
|
|
36
|
+
remainder = @width % m
|
|
37
|
+
@width += (m - remainder) unless remainder.zero?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def calculate_positions!
|
|
41
|
+
@images.each_with_index do |image, index|
|
|
42
|
+
image.left = (image.position.unit_str == "%" ? (@width - image.width) * (image.position.value / 100.0) : image.position.value).to_i
|
|
43
|
+
next if index == 0
|
|
44
|
+
last_image = @images[index-1]
|
|
45
|
+
image.top = last_image.top + last_image.height + [image.spacing, last_image.spacing].max
|
|
46
|
+
end #each_with_index
|
|
47
|
+
end #method
|
|
48
|
+
|
|
49
|
+
def tile_images_that_repeat!
|
|
50
|
+
return unless repeating_images?
|
|
51
|
+
@images.map {|img| img if img.repeat_x?}.compact.each do |image|
|
|
52
|
+
x = image.left - (image.left / image.width).ceil * image.width
|
|
53
|
+
while x < @width do
|
|
54
|
+
begin
|
|
55
|
+
img = image.dup
|
|
56
|
+
img.top = image.top
|
|
57
|
+
img.left = x.to_i
|
|
58
|
+
@images << img
|
|
59
|
+
x += image.width
|
|
60
|
+
end #begin
|
|
61
|
+
end #while
|
|
62
|
+
end #map
|
|
63
|
+
end #method
|
|
64
|
+
end #Vertical
|
|
65
|
+
end #Layout
|
|
66
|
+
end #Sprites
|
|
67
|
+
end #SassExtensions
|
|
68
|
+
end #Compass
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'rational'
|
|
2
|
+
module Compass
|
|
3
|
+
module SassExtensions
|
|
4
|
+
module Sprites
|
|
5
|
+
module Layout
|
|
6
|
+
class SpriteLayout
|
|
7
|
+
|
|
8
|
+
attr_reader :images, :options
|
|
9
|
+
attr_accessor :height, :width
|
|
10
|
+
|
|
11
|
+
def initialize(images, kwargs={})
|
|
12
|
+
@images = images
|
|
13
|
+
@options = kwargs
|
|
14
|
+
@height = 0
|
|
15
|
+
@width = 0
|
|
16
|
+
|
|
17
|
+
layout!
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def layout!
|
|
21
|
+
raise Compass::SpriteException, "You must impliment layout!"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def properties
|
|
25
|
+
if @width.zero?
|
|
26
|
+
raise Compass::SpriteException, "You must set the width fetching the properties"
|
|
27
|
+
end
|
|
28
|
+
if @height.zero?
|
|
29
|
+
raise Compass::SpriteException, "You must set the height fetching the properties"
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
[@images, @width, @height]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module LayoutMethods
|
|
5
|
+
HORIZONTAL = 'horizontal'
|
|
6
|
+
DIAGONAL = 'diagonal'
|
|
7
|
+
SMART = 'smart'
|
|
8
|
+
VERTICAL = 'vertical'
|
|
9
|
+
|
|
10
|
+
def smart?
|
|
11
|
+
layout == SMART
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def horizontal?
|
|
15
|
+
layout == HORIZONTAL
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def diagonal?
|
|
19
|
+
layout == DIAGONAL
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def vertical?
|
|
23
|
+
layout == VERTICAL
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def layout
|
|
27
|
+
@layout ||= @kwargs.get_var('layout').value
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Calculates the overal image dimensions
|
|
31
|
+
# collects image sizes and input parameters for each sprite
|
|
32
|
+
def compute_image_positions!
|
|
33
|
+
case layout
|
|
34
|
+
when SMART
|
|
35
|
+
require 'compass/sass_extensions/sprites/layout/smart'
|
|
36
|
+
@images, @width, @height = Layout::Smart.new(@images, @kwargs).properties
|
|
37
|
+
when DIAGONAL
|
|
38
|
+
require 'compass/sass_extensions/sprites/layout/diagonal'
|
|
39
|
+
@images, @width, @height = Layout::Diagonal.new(@images, @kwargs).properties
|
|
40
|
+
when HORIZONTAL
|
|
41
|
+
require 'compass/sass_extensions/sprites/layout/horizontal'
|
|
42
|
+
@images, @width, @height = Layout::Horizontal.new(@images, @kwargs).properties
|
|
43
|
+
else
|
|
44
|
+
require 'compass/sass_extensions/sprites/layout/vertical'
|
|
45
|
+
@images, @width, @height = Layout::Vertical.new(@images, @kwargs).properties
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
require 'forwardable'
|
|
2
|
+
|
|
3
|
+
module Compass
|
|
4
|
+
module SassExtensions
|
|
5
|
+
module Sprites
|
|
6
|
+
class RowFitter
|
|
7
|
+
extend Forwardable
|
|
8
|
+
|
|
9
|
+
attr_reader :images, :rows
|
|
10
|
+
def_delegators :rows, :[]
|
|
11
|
+
|
|
12
|
+
def initialize(images)
|
|
13
|
+
@images = images.sort do |a,b|
|
|
14
|
+
if a.height == b.height
|
|
15
|
+
b.width <=> a.width
|
|
16
|
+
else
|
|
17
|
+
a.height <=> b.height
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
@rows = []
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def fit!(style = :scan)
|
|
24
|
+
send("#{style}_fit")
|
|
25
|
+
@rows
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def width
|
|
29
|
+
@width ||= @images.collect(&:width).max
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def height
|
|
33
|
+
@height ||= @rows.inject(0) {|sum, row| sum += row.height}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def efficiency
|
|
37
|
+
@rows.inject(0) { |sum, row| sum += row.efficiency } ** @rows.length
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
def new_row(image = nil)
|
|
42
|
+
row = Compass::SassExtensions::Sprites::ImageRow.new(width)
|
|
43
|
+
row.add(image) if image
|
|
44
|
+
row
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def fast_fit
|
|
48
|
+
row = new_row
|
|
49
|
+
@images.each do |image|
|
|
50
|
+
if !row.add(image)
|
|
51
|
+
@rows << row
|
|
52
|
+
row = new_row(image)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
@rows << row
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def scan_fit
|
|
60
|
+
fast_fit
|
|
61
|
+
|
|
62
|
+
moved_images = []
|
|
63
|
+
|
|
64
|
+
begin
|
|
65
|
+
removed = false
|
|
66
|
+
|
|
67
|
+
catch :done do
|
|
68
|
+
@rows.each do |row|
|
|
69
|
+
(@rows - [ row ]).each do |other_row|
|
|
70
|
+
other_row.images.each do |image|
|
|
71
|
+
if !moved_images.include?(image)
|
|
72
|
+
if row.will_fit?(image)
|
|
73
|
+
other_row.delete(image)
|
|
74
|
+
row << image
|
|
75
|
+
|
|
76
|
+
@rows.delete(other_row) if other_row.empty?
|
|
77
|
+
removed = true
|
|
78
|
+
|
|
79
|
+
moved_images << image
|
|
80
|
+
throw :done
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end while removed
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|