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,93 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
class SpriteMap < Sass::Script::Value::Base
|
|
5
|
+
attr_accessor :image_names, :path, :name, :map, :kwargs
|
|
6
|
+
attr_accessor :images, :width, :height, :engine
|
|
7
|
+
|
|
8
|
+
include SpriteMethods
|
|
9
|
+
include ImageMethods
|
|
10
|
+
include LayoutMethods
|
|
11
|
+
include Sass::Script::Value::Helpers
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Initialize a new sprite object from a relative file path
|
|
15
|
+
# the path is relative to the <tt>images_path</tt> confguration option
|
|
16
|
+
def self.from_uri(uri, context, kwargs)
|
|
17
|
+
uri = uri.value
|
|
18
|
+
path, name = Compass::SpriteImporter.path_and_name(uri)
|
|
19
|
+
files = Compass::SpriteImporter.files(uri)
|
|
20
|
+
sprites = files.map do |sprite|
|
|
21
|
+
relative_name(sprite)
|
|
22
|
+
end
|
|
23
|
+
new(sprites, path, name, context, kwargs)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def self.relative_name(sprite)
|
|
27
|
+
sprite = File.expand_path(sprite)
|
|
28
|
+
Compass.configuration.sprite_load_path.each do |path|
|
|
29
|
+
path_with_slash = "#{File.expand_path(path)}/"
|
|
30
|
+
|
|
31
|
+
if sprite.include?(path_with_slash)
|
|
32
|
+
return sprite.gsub(path_with_slash, '')
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def initialize(sprites, path, name, context, kwargs)
|
|
38
|
+
@image_names = sprites
|
|
39
|
+
@path = path
|
|
40
|
+
@name = name
|
|
41
|
+
@kwargs = kwargs
|
|
42
|
+
@kwargs['cleanup'] ||= bool(true)
|
|
43
|
+
@kwargs['layout'] ||= identifier('vertical')
|
|
44
|
+
@kwargs['sort_by'] ||= identifier('none')
|
|
45
|
+
@images = nil
|
|
46
|
+
@width = nil
|
|
47
|
+
@height = nil
|
|
48
|
+
@engine = nil
|
|
49
|
+
@evaluation_context = context
|
|
50
|
+
compute_image_metadata!
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def sort_method
|
|
54
|
+
@kwargs['sort_by'].value
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def inspect
|
|
58
|
+
puts 'images'
|
|
59
|
+
@images.each do |img|
|
|
60
|
+
puts img.file
|
|
61
|
+
end
|
|
62
|
+
puts "options"
|
|
63
|
+
@kwargs.each do |k,v|
|
|
64
|
+
puts "#{k}:#{v}"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def to_s(kwargs = self.kwargs)
|
|
69
|
+
sprite_url(self).value
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def respond_to?(meth)
|
|
73
|
+
super || @evaluation_context.respond_to?(meth)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def method_missing(meth, *args, &block)
|
|
77
|
+
if @evaluation_context.respond_to?(meth)
|
|
78
|
+
@evaluation_context.send(meth, *args, &block)
|
|
79
|
+
else
|
|
80
|
+
super
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def modulize
|
|
87
|
+
@modulize ||= Compass::configuration.sprite_engine.to_s.scan(/([^_.]+)/).flatten.map {|chunk| "#{chunk[0].chr.upcase}#{chunk[1..-1]}" }.join
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module SassExtensions
|
|
3
|
+
module Sprites
|
|
4
|
+
module SpriteMethods
|
|
5
|
+
|
|
6
|
+
# Changing this string will invalidate all previously generated sprite images.
|
|
7
|
+
# We should do so only when the packing algorithm changes
|
|
8
|
+
SPRITE_VERSION = "2"
|
|
9
|
+
|
|
10
|
+
# Calculates the overal image dimensions
|
|
11
|
+
# collects image sizes and input parameters for each sprite
|
|
12
|
+
# Calculates the height
|
|
13
|
+
def compute_image_metadata!
|
|
14
|
+
@width = 0
|
|
15
|
+
init_images
|
|
16
|
+
compute_image_positions!
|
|
17
|
+
init_engine
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def init_engine
|
|
21
|
+
@engine = eval("::Compass::SassExtensions::Sprites::#{modulize}Engine.new(nil, nil, nil)")
|
|
22
|
+
@engine.width = @width
|
|
23
|
+
@engine.height = @height
|
|
24
|
+
@engine.images = @images
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Creates the Sprite::Image objects for each image and calculates the width
|
|
28
|
+
def init_images
|
|
29
|
+
@images = Images.new
|
|
30
|
+
image_names.each do |relative_file|
|
|
31
|
+
@images << Image.new(self, relative_file, kwargs)
|
|
32
|
+
end
|
|
33
|
+
unless sort_method == 'none'
|
|
34
|
+
@images.sort_by! sort_method
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def name_and_hash
|
|
39
|
+
"#{path}-s#{uniqueness_hash}.png"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# The on-the-disk filename of the sprite
|
|
43
|
+
def filename
|
|
44
|
+
File.join(Compass.configuration.generated_images_path, name_and_hash)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def relativize(path)
|
|
48
|
+
Pathname.new(path).relative_path_from(Pathname.new(Dir.pwd)).to_s rescue path
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Generate a sprite image if necessary
|
|
52
|
+
def generate
|
|
53
|
+
if generation_required?
|
|
54
|
+
if kwargs.get_var('cleanup').value
|
|
55
|
+
cleanup_old_sprites
|
|
56
|
+
end
|
|
57
|
+
engine.construct_sprite
|
|
58
|
+
Compass.configuration.run_sprite_generated(engine.canvas)
|
|
59
|
+
save!
|
|
60
|
+
else
|
|
61
|
+
log :unchanged, filename
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def cleanup_old_sprites
|
|
66
|
+
Sass::Util.glob(File.join(Compass.configuration.generated_images_path, "#{path}-s*.png")).each do |file|
|
|
67
|
+
log :remove, file
|
|
68
|
+
FileUtils.rm file
|
|
69
|
+
Compass.configuration.run_sprite_removed(file)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# Does this sprite need to be generated
|
|
74
|
+
def generation_required?
|
|
75
|
+
!File.exist?(filename) || outdated? || options[:force]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Returns the uniqueness hash for this sprite object
|
|
79
|
+
def uniqueness_hash
|
|
80
|
+
@uniqueness_hash ||= begin
|
|
81
|
+
sum = Digest::MD5.new
|
|
82
|
+
sum << SPRITE_VERSION
|
|
83
|
+
sum << path
|
|
84
|
+
sum << layout
|
|
85
|
+
images.each do |image|
|
|
86
|
+
[:relative_file, :height, :width, :repeat, :spacing, :position, :digest].each do |attr|
|
|
87
|
+
sum << image.send(attr).to_s
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
sum.hexdigest[0...10]
|
|
91
|
+
end
|
|
92
|
+
@uniqueness_hash
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Saves the sprite engine
|
|
96
|
+
def save!
|
|
97
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
|
98
|
+
saved = engine.save(filename)
|
|
99
|
+
log :create, filename
|
|
100
|
+
Compass.configuration.run_sprite_saved(filename)
|
|
101
|
+
@mtime = nil if saved
|
|
102
|
+
saved
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# All the full-path filenames involved in this sprite
|
|
106
|
+
def image_filenames
|
|
107
|
+
@images.map(&:file)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Checks whether this sprite is outdated
|
|
111
|
+
def outdated?
|
|
112
|
+
if File.exist?(filename)
|
|
113
|
+
return @images.any? {|image| image.mtime.to_i > self.mtime.to_i }
|
|
114
|
+
end
|
|
115
|
+
true
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
# Mtime of the sprite file
|
|
119
|
+
def mtime
|
|
120
|
+
@mtime ||= File.mtime(filename)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Calculate the size of the sprite
|
|
124
|
+
def size
|
|
125
|
+
[width, height]
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def log(action, filename, *extra)
|
|
129
|
+
if options[:compass] && options[:compass][:logger] && !options[:quiet]
|
|
130
|
+
options[:compass][:logger].record(action, relativize(filename), *extra)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'digest/md5'
|
|
2
|
+
require 'compass/sprite_importer'
|
|
3
|
+
|
|
4
|
+
module Compass
|
|
5
|
+
module SassExtensions
|
|
6
|
+
module Sprites
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'compass/sass_extensions/sprites/images'
|
|
12
|
+
require 'compass/sass_extensions/sprites/layout'
|
|
13
|
+
require 'compass/sass_extensions/sprites/image_row'
|
|
14
|
+
require 'compass/sass_extensions/sprites/row_fitter'
|
|
15
|
+
require 'compass/sass_extensions/sprites/image'
|
|
16
|
+
require 'compass/sass_extensions/sprites/layout_methods'
|
|
17
|
+
require 'compass/sass_extensions/sprites/sprite_methods'
|
|
18
|
+
require 'compass/sass_extensions/sprites/image_methods'
|
|
19
|
+
require 'compass/sass_extensions/sprites/sprite_map'
|
|
20
|
+
require 'compass/sass_extensions/sprites/engines'
|
|
21
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
unless Sass::Script::Functions.methods.grep(/\Adeclare\Z/).any?
|
|
2
|
+
raise LoadError, "It looks like you've got an incompatible version of Sass. This often happens when you have an old haml gem installed. Please upgrade Haml to v3.1 or above."
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
module Compass::SassExtensions
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
require 'compass/sass_extensions/functions'
|
|
9
|
+
require 'compass/sass_extensions/sprites'
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
@import "compass/utilities/sprites/base";
|
|
2
|
+
|
|
3
|
+
// General Sprite Defaults
|
|
4
|
+
// You can override them before you import this file.
|
|
5
|
+
$<%= name %>-sprite-dimensions : false !default;
|
|
6
|
+
$<%= name %>-use-percentages : false !default;
|
|
7
|
+
$<%= name %>-position : 0% !default;
|
|
8
|
+
$<%= name %>-spacing : 0 !default;
|
|
9
|
+
$<%= name %>-repeat : no-repeat !default;
|
|
10
|
+
$<%= name %>-prefix : '' !default;
|
|
11
|
+
$<%= name %>-clean-up : true !default;
|
|
12
|
+
$<%= name %>-layout : vertical !default;
|
|
13
|
+
$<%= name %>-inline : false !default;
|
|
14
|
+
$<%= name %>-sort-by : 'none' !default;
|
|
15
|
+
$<%= name %>-class-separator : $default-sprite-separator !default;
|
|
16
|
+
$<%= name %>-sprite-base-class : ".<%= name %>#{$<%= name %>-class-separator}sprite" !default;
|
|
17
|
+
|
|
18
|
+
<% if skip_overrides %>
|
|
19
|
+
$<%= name %>-sprites: sprite-map("<%= uri %>", $layout: $<%= name %>-layout, $cleanup: $<%= name %>-clean-up, $spacing: $<%= name %>-spacing, $position : $<%= name %>-position);
|
|
20
|
+
<% else %>
|
|
21
|
+
// These variables control the generated sprite output
|
|
22
|
+
// You can override them selectively before you import this file.
|
|
23
|
+
<% sprite_names.each do |sprite_name| %>
|
|
24
|
+
$<%= name %>-<%= sprite_name %>-position: $<%= name %>-position !default;
|
|
25
|
+
$<%= name %>-<%= sprite_name %>-spacing: $<%= name %>-spacing !default;
|
|
26
|
+
$<%= name %>-<%= sprite_name %>-repeat: $<%= name %>-repeat !default;
|
|
27
|
+
<% end %>
|
|
28
|
+
|
|
29
|
+
$<%= name %>-sprites: sprite-map("<%= uri %>",
|
|
30
|
+
<% sprite_names.each do |sprite_name| %>
|
|
31
|
+
$<%= name %>-<%= sprite_name %>-position: $<%= name %>-<%= sprite_name %>-position,
|
|
32
|
+
$<%= name %>-<%= sprite_name %>-spacing: $<%= name %>-<%= sprite_name %>-spacing,
|
|
33
|
+
$<%= name %>-<%= sprite_name %>-repeat: $<%= name %>-<%= sprite_name %>-repeat,
|
|
34
|
+
<% end %>
|
|
35
|
+
$layout : $<%= name %>-layout,
|
|
36
|
+
$cleanup : $<%= name %>-clean-up,
|
|
37
|
+
$spacing : $<%= name %>-spacing,
|
|
38
|
+
$position : $<%= name %>-position,
|
|
39
|
+
$sort-by : $<%= name %>-sort-by
|
|
40
|
+
);
|
|
41
|
+
<% end %>
|
|
42
|
+
|
|
43
|
+
// All sprites should extend this class
|
|
44
|
+
// The <%= name %>-sprite mixin will do so for you.
|
|
45
|
+
@if $<%= name %>-inline {
|
|
46
|
+
#{$<%= name %>-sprite-base-class} {
|
|
47
|
+
background-image: inline-sprite($<%= name %>-sprites);
|
|
48
|
+
}
|
|
49
|
+
} @else {
|
|
50
|
+
#{$<%= name %>-sprite-base-class} {
|
|
51
|
+
background-image: sprite-url($<%= name %>-sprites);
|
|
52
|
+
background-repeat: no-repeat;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//sass functions to return the dimensions of a sprite image as units
|
|
56
|
+
<% [:width, :height].each do |dimension| %>
|
|
57
|
+
@function <%= name %>-sprite-<%= dimension %>($name) {
|
|
58
|
+
@return sprite-<%= dimension %>($<%= name %>-sprites, $name);
|
|
59
|
+
}
|
|
60
|
+
<% end %>
|
|
61
|
+
|
|
62
|
+
// Use this to set the dimensions of an element
|
|
63
|
+
// based on the size of the original image.
|
|
64
|
+
@mixin <%= name %>-sprite-dimensions($name) {
|
|
65
|
+
@include sprite-dimensions($<%= name %>-sprites, $name)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Move the background position to display the sprite.
|
|
69
|
+
@mixin <%= name %>-sprite-position($name, $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages) {
|
|
70
|
+
@include sprite-background-position($<%= name %>-sprites, $name, $offset-x, $offset-y, $use-percentages)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Extends the sprite base class and set the background position for the desired sprite.
|
|
74
|
+
// It will also apply the image dimensions if $dimensions is true.
|
|
75
|
+
@mixin <%= name %>-sprite($name, $dimensions: $<%= name %>-sprite-dimensions, $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
|
|
76
|
+
@extend #{$<%= name %>-sprite-base-class};
|
|
77
|
+
@include sprite($<%= name %>-sprites, $name, $dimensions, $offset-x, $offset-y, $use-percentages, $separator: $separator);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@mixin <%= name %>-sprites($sprite-names, $dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
|
|
81
|
+
@include sprites($<%= name %>-sprites, $sprite-names, $<%= name %>-sprite-base-class, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages, $separator: $separator)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Generates a class for each sprited image.
|
|
85
|
+
@mixin all-<%= name %>-sprites($dimensions: $<%= name %>-sprite-dimensions, $prefix: sprite-map-name($<%= name %>-sprites), $offset-x: 0, $offset-y: 0, $use-percentages: $<%= name %>-use-percentages, $separator: $<%= name %>-class-separator) {
|
|
86
|
+
@include <%= name %>-sprites(<%= sprite_names.join(" ") %>, $dimensions, $prefix, $offset-x, $offset-y, $use-percentages, $separator: $separator);
|
|
87
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
require 'compass/sprite_importer/binding'
|
|
3
|
+
module Compass
|
|
4
|
+
class SpriteImporter < Sass::Importers::Base
|
|
5
|
+
VAILD_FILE_NAME = /\A#{Sass::SCSS::RX::IDENT}\Z/
|
|
6
|
+
SPRITE_IMPORTER_REGEX = %r{((.+/)?([^\*.]+))/(.+?)\.png}
|
|
7
|
+
VALID_EXTENSIONS = ['.png']
|
|
8
|
+
|
|
9
|
+
TEMPLATE_FOLDER = File.join(File.expand_path('../', __FILE__), 'sprite_importer')
|
|
10
|
+
CONTENT_TEMPLATE_FILE = File.join(TEMPLATE_FOLDER, 'content.erb')
|
|
11
|
+
CONTENT_TEMPLATE = ERB.new(File.read(CONTENT_TEMPLATE_FILE))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# finds all sprite files
|
|
16
|
+
def self.find_all_sprite_map_files(path)
|
|
17
|
+
hex = "[0-9a-f]"
|
|
18
|
+
glob = "*-s#{hex*10}{#{VALID_EXTENSIONS.join(",")}}"
|
|
19
|
+
Sass::Util.glob(File.join(path, "**", glob))
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def find(uri, options)
|
|
23
|
+
if uri =~ SPRITE_IMPORTER_REGEX
|
|
24
|
+
return self.class.sass_engine(uri, self.class.sprite_name(uri), self, options)
|
|
25
|
+
end
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def find_relative(uri, base, options)
|
|
30
|
+
nil
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def to_s
|
|
34
|
+
self.class.name
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def hash
|
|
38
|
+
self.class.name.hash
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def eql?(other)
|
|
42
|
+
other.class == self.class
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def mtime(uri, options)
|
|
46
|
+
self.class.files(uri).sort.inject(Time.at(0)) do |max_time, file|
|
|
47
|
+
(t = File.mtime(file)) > max_time ? t : max_time
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def key(uri, options={})
|
|
52
|
+
[self.class.name + ":sprite:" + File.dirname(File.expand_path(uri)), File.basename(uri)]
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def public_url(*args)
|
|
56
|
+
nil
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def self.path_and_name(uri)
|
|
61
|
+
if uri =~ SPRITE_IMPORTER_REGEX
|
|
62
|
+
[$1, $3]
|
|
63
|
+
else
|
|
64
|
+
raise Compass::Error, "invalid sprite path"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Name of this spite
|
|
69
|
+
def self.sprite_name(uri)
|
|
70
|
+
_, name = path_and_name(uri)
|
|
71
|
+
name
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# The on-disk location of this sprite
|
|
75
|
+
def self.path(uri)
|
|
76
|
+
path, _ = path_and_name(uri)
|
|
77
|
+
path
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# Returns the Glob of image files for the uri
|
|
81
|
+
def self.files(uri)
|
|
82
|
+
Compass.configuration.sprite_load_path.compact.each do |folder|
|
|
83
|
+
files = Sass::Util.glob(File.join(folder, uri)).sort
|
|
84
|
+
next if files.empty?
|
|
85
|
+
return files
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
path = Compass.configuration.sprite_load_path.to_a.join(', ')
|
|
89
|
+
raise Compass::SpriteException, %Q{No files were found in the load path matching "#{uri}". Your current load paths are: #{path}}
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# Returns an Array of image names without the file extension
|
|
93
|
+
def self.sprite_names(uri)
|
|
94
|
+
files(uri).collect do |file|
|
|
95
|
+
File.basename(file, '.png')
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Returns the sass_options for this sprite
|
|
100
|
+
def self.sass_options(uri, importer, options)
|
|
101
|
+
options.merge!(:filename => uri.gsub(%r{\*/},"*\\/"), :syntax => :scss, :importer => importer)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# Returns a Sass::Engine for this sprite object
|
|
105
|
+
def self.sass_engine(uri, name, importer, options)
|
|
106
|
+
content = content_for_images(uri, name, options[:skip_overrides])
|
|
107
|
+
Sass::Engine.new(content, sass_options(uri, importer, options))
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Generates the Sass for this sprite file
|
|
111
|
+
def self.content_for_images(uri, name, skip_overrides = false)
|
|
112
|
+
binder = Compass::Sprites::Binding.new(:name => name, :uri => uri, :skip_overrides => skip_overrides, :sprite_names => sprite_names(uri), :files => files(uri))
|
|
113
|
+
CONTENT_TEMPLATE.result(binder.get_binding)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
module Stats
|
|
3
|
+
class StatsVisitor
|
|
4
|
+
attr_accessor :rule_count, :prop_count, :mixin_def_count, :mixin_count
|
|
5
|
+
def initialize
|
|
6
|
+
self.rule_count = 0
|
|
7
|
+
self.prop_count = 0
|
|
8
|
+
self.mixin_def_count = 0
|
|
9
|
+
self.mixin_count = 0
|
|
10
|
+
end
|
|
11
|
+
def visit(node)
|
|
12
|
+
self.prop_count += 1 if node.is_a?(Sass::Tree::PropNode) && !node.children.any?
|
|
13
|
+
if node.is_a?(Sass::Tree::RuleNode)
|
|
14
|
+
self.rule_count += node.rule.reject{|r| r.is_a?(Sass::Script::Tree::Node)}.map{|r| r.split(/,/)}.flatten.compact.size
|
|
15
|
+
end
|
|
16
|
+
self.mixin_def_count += 1 if node.is_a?(Sass::Tree::MixinDefNode)
|
|
17
|
+
self.mixin_count += 1 if node.is_a?(Sass::Tree::MixinNode)
|
|
18
|
+
end
|
|
19
|
+
def up(node)
|
|
20
|
+
end
|
|
21
|
+
def down(node)
|
|
22
|
+
end
|
|
23
|
+
def import?(node)
|
|
24
|
+
return false
|
|
25
|
+
full_filename = node.send(:import)
|
|
26
|
+
full_filename != Compass.deprojectize(full_filename)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
class CssFile
|
|
30
|
+
attr_accessor :path, :css
|
|
31
|
+
attr_accessor :selector_count, :prop_count
|
|
32
|
+
attr_accessor :file_size
|
|
33
|
+
def initialize(path)
|
|
34
|
+
require 'css_parser'
|
|
35
|
+
self.path = path
|
|
36
|
+
self.css = CssParser::Parser.new
|
|
37
|
+
self.css.add_block!(contents)
|
|
38
|
+
self.selector_count = 0
|
|
39
|
+
self.prop_count = 0
|
|
40
|
+
end
|
|
41
|
+
def contents
|
|
42
|
+
@contents ||= File.read(path)
|
|
43
|
+
end
|
|
44
|
+
def lines
|
|
45
|
+
contents.inject(0){|m,c| m + 1 }
|
|
46
|
+
end
|
|
47
|
+
def analyze!
|
|
48
|
+
self.file_size = File.size(path)
|
|
49
|
+
css.each_selector do |selector, declarations, specificity|
|
|
50
|
+
sels = selector.split(/,/).size
|
|
51
|
+
props = declarations.split(/;/).size
|
|
52
|
+
self.selector_count += sels
|
|
53
|
+
self.prop_count += props
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
class SassFile
|
|
58
|
+
attr_accessor :path
|
|
59
|
+
attr_reader :visitor
|
|
60
|
+
attr_accessor :file_size
|
|
61
|
+
|
|
62
|
+
def initialize(path)
|
|
63
|
+
self.path = path
|
|
64
|
+
end
|
|
65
|
+
def contents
|
|
66
|
+
@contents ||= File.read(path)
|
|
67
|
+
end
|
|
68
|
+
def tree
|
|
69
|
+
opts = Compass.configuration.to_sass_engine_options
|
|
70
|
+
opts[:syntax] = path[-4..-1].to_sym
|
|
71
|
+
@tree = Sass::Engine.new(contents, opts).to_tree
|
|
72
|
+
end
|
|
73
|
+
def visit_tree!
|
|
74
|
+
@visitor = StatsVisitor.new
|
|
75
|
+
tree.visit_depth_first(@visitor)
|
|
76
|
+
@visitor
|
|
77
|
+
end
|
|
78
|
+
def analyze!
|
|
79
|
+
self.file_size = File.size(path)
|
|
80
|
+
visit_tree!
|
|
81
|
+
end
|
|
82
|
+
def lines
|
|
83
|
+
contents.inject(0){|m,c| m + 1 }
|
|
84
|
+
end
|
|
85
|
+
def rule_count
|
|
86
|
+
visitor.rule_count
|
|
87
|
+
end
|
|
88
|
+
def prop_count
|
|
89
|
+
visitor.prop_count
|
|
90
|
+
end
|
|
91
|
+
def mixin_def_count
|
|
92
|
+
visitor.mixin_def_count
|
|
93
|
+
end
|
|
94
|
+
def mixin_count
|
|
95
|
+
visitor.mixin_count
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
module Compass
|
|
2
|
+
# Write your unit test like this if you want to make sure all your stylesheets compile.
|
|
3
|
+
#
|
|
4
|
+
# require 'compass/test_case'
|
|
5
|
+
# class StylesheetsTest < Compass::TestCase
|
|
6
|
+
# def test_stylesheets
|
|
7
|
+
# my_sass_files.each do |sass_file|
|
|
8
|
+
# assert_compiles(sass_file) do |result|
|
|
9
|
+
# assert_not_blank result
|
|
10
|
+
# end
|
|
11
|
+
# end
|
|
12
|
+
# end
|
|
13
|
+
# protected
|
|
14
|
+
# def my_sass_files
|
|
15
|
+
# Dir.glob(File.expand_path(File.join(File.dirname(__FILE__), "../..", "app/stylesheets/**/[^_]*.sass")))
|
|
16
|
+
# end
|
|
17
|
+
# end
|
|
18
|
+
class TestCase < (defined?(ActiveSupport::TestCase) ? ActiveSupport::TestCase : Test::Unit::TestCase)
|
|
19
|
+
|
|
20
|
+
def setup
|
|
21
|
+
super
|
|
22
|
+
@last_compile = nil
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def compile(stylesheet)
|
|
26
|
+
input = open(stylesheet)
|
|
27
|
+
template = input.read()
|
|
28
|
+
input.close()
|
|
29
|
+
@last_compile = ::Sass::Engine.new(template, ::Sass::Plugin.engine_options(:filename => stylesheet)).render
|
|
30
|
+
yield @last_compile if block_given?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def assert_compiles(stylesheet, &block)
|
|
34
|
+
compile(stylesheet, &block)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'compass-validator'
|
|
4
|
+
rescue LoadError => e
|
|
5
|
+
if e.message =~ /core_ext/
|
|
6
|
+
raise Compass::MissingDependency, <<-ERRORMSG
|
|
7
|
+
The Compass CSS Validator is out of date. Please upgrade it:
|
|
8
|
+
sudo gem install compass-validator --version ">= 3.0.1"
|
|
9
|
+
ERRORMSG
|
|
10
|
+
else
|
|
11
|
+
raise Compass::MissingDependency, <<-ERRORMSG
|
|
12
|
+
The Compass CSS Validator could not be loaded. Please install it:
|
|
13
|
+
sudo gem install compass-validator
|
|
14
|
+
ERRORMSG
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'compass/generated_version'
|
|
2
|
+
module Compass
|
|
3
|
+
module Version
|
|
4
|
+
def scope(file) # :nodoc:
|
|
5
|
+
File.join(File.dirname(__FILE__), '..', '..', file)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def parse_version(version, name)
|
|
9
|
+
nil_or_int = lambda{|i| i.nil? ? nil : i.to_i}
|
|
10
|
+
segments = version.split(".")
|
|
11
|
+
{
|
|
12
|
+
:string => version,
|
|
13
|
+
:name => name,
|
|
14
|
+
:major => nil_or_int.call(segments.shift),
|
|
15
|
+
:minor => nil_or_int.call(segments.shift),
|
|
16
|
+
:patch => nil_or_int.call(segments.shift),
|
|
17
|
+
:state => segments.shift,
|
|
18
|
+
:iteration => nil_or_int.call(segments.shift)
|
|
19
|
+
}
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Returns a hash representing the version.
|
|
23
|
+
# The :major, :minor, and :teeny keys have their respective numbers.
|
|
24
|
+
# The :string key contains a human-readable string representation of the version.
|
|
25
|
+
# The :rev key will have the current revision hash.
|
|
26
|
+
#
|
|
27
|
+
# This method swiped from Haml and then modified, some credit goes to Nathan Weizenbaum
|
|
28
|
+
def version
|
|
29
|
+
Compass::VERSION_DETAILS
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
extend Compass::Version
|
|
34
|
+
|
|
35
|
+
unless defined?(::Compass::VERSION)
|
|
36
|
+
VERSION = File.read(scope("VERSION")).strip
|
|
37
|
+
VERSION_NAME = File.read(scope("VERSION_NAME")).strip
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
VERSION_DETAILS = parse_version(VERSION, VERSION_NAME)
|
|
41
|
+
|
|
42
|
+
end
|