compass 0.12.7 → 0.13.alpha.4
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.
- data/README.markdown +1 -1
- data/Rakefile +14 -9
- data/VERSION.yml +6 -0
- data/features/command_line.feature +8 -50
- data/features/step_definitions/command_line_steps.rb +3 -2
- data/frameworks/compass/stylesheets/compass/_css3.scss +2 -0
- data/frameworks/compass/stylesheets/compass/_support.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_animation.scss +121 -0
- data/frameworks/compass/stylesheets/compass/css3/_appearance.scss +10 -6
- data/frameworks/compass/stylesheets/compass/css3/_background-clip.scss +32 -36
- data/frameworks/compass/stylesheets/compass/css3/_background-origin.scss +32 -35
- data/frameworks/compass/stylesheets/compass/css3/_background-size.scss +12 -15
- data/frameworks/compass/stylesheets/compass/css3/_border-radius.scss +27 -48
- data/frameworks/compass/stylesheets/compass/css3/_box-shadow.scss +22 -35
- data/frameworks/compass/stylesheets/compass/css3/_box-sizing.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_box.scss +57 -82
- data/frameworks/compass/stylesheets/compass/css3/_columns.scss +104 -71
- data/frameworks/compass/stylesheets/compass/css3/_filter.scss +38 -18
- data/frameworks/compass/stylesheets/compass/css3/_flexbox.scss +294 -0
- data/frameworks/compass/stylesheets/compass/css3/_font-face.scss +4 -4
- data/frameworks/compass/stylesheets/compass/css3/_hyphenation.scss +13 -22
- data/frameworks/compass/stylesheets/compass/css3/_images.scss +45 -48
- data/frameworks/compass/stylesheets/compass/css3/_inline-block.scss +1 -1
- data/frameworks/compass/stylesheets/compass/css3/_regions.scss +12 -8
- data/frameworks/compass/stylesheets/compass/css3/_selection.scss +31 -0
- data/frameworks/compass/stylesheets/compass/css3/_shared.scss +226 -2
- data/frameworks/compass/stylesheets/compass/css3/_text-shadow.scss +21 -26
- data/frameworks/compass/stylesheets/compass/css3/_transform-legacy.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_transform.scss +8 -8
- data/frameworks/compass/stylesheets/compass/css3/_transition.scss +3 -3
- data/frameworks/compass/stylesheets/compass/css3/_user-interface.scss +43 -4
- data/frameworks/compass/stylesheets/compass/typography/_units.scss +152 -0
- data/frameworks/compass/stylesheets/compass/typography/_vertical_rhythm.scss +180 -102
- data/frameworks/compass/stylesheets/compass/typography/lists/_horizontal-list.scss +5 -3
- data/frameworks/compass/stylesheets/compass/typography/lists/_inline-list.scss +6 -3
- data/frameworks/compass/stylesheets/compass/typography/text/_ellipsis.scss +1 -1
- data/frameworks/compass/stylesheets/compass/utilities/general/_float.scss +7 -3
- data/frameworks/compass/stylesheets/compass/utilities/general/_hacks.scss +2 -2
- data/frameworks/compass/stylesheets/compass/utilities/sprites/_base.scss +32 -13
- data/frameworks/compass/stylesheets/compass/utilities/tables/_borders.scss +14 -9
- data/lib/compass/actions.rb +3 -1
- data/lib/compass/commands/update_project.rb +1 -2
- data/lib/compass/commands/watch_project.rb +11 -113
- data/lib/compass/commands.rb +1 -1
- data/lib/compass/compiler.rb +8 -1
- data/lib/compass/configuration/data.rb +1 -1
- data/lib/compass/configuration/helpers.rb +2 -0
- data/lib/compass/exec/project_options_parser.rb +8 -0
- data/lib/compass/logger.rb +2 -0
- data/lib/compass/sass_extensions/functions/cross_browser_support.rb +1 -1
- data/lib/compass/sass_extensions/functions/env.rb +18 -0
- data/lib/compass/sass_extensions/functions/gradient_support.rb +101 -29
- data/lib/compass/sass_extensions/functions/image_size.rb +2 -1
- data/lib/compass/sass_extensions/functions/math.rb +13 -1
- data/lib/compass/sass_extensions/functions/sprites.rb +82 -22
- data/lib/compass/sass_extensions/functions/urls.rb +37 -6
- data/lib/compass/sass_extensions/functions/utility.rb +10 -0
- data/lib/compass/sass_extensions/sprites/engines/chunky_png_engine.rb +11 -9
- data/lib/compass/sass_extensions/sprites/image.rb +7 -2
- data/lib/compass/sass_extensions/sprites/image_methods.rb +5 -1
- 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 +9 -115
- data/lib/compass/sass_extensions/sprites/sprite_map.rb +5 -1
- data/lib/compass/sass_extensions/sprites/sprite_methods.rb +8 -14
- data/lib/compass/sass_extensions/sprites.rb +2 -0
- data/lib/compass/sprite_importer/content.erb +29 -24
- data/lib/compass/sprite_importer.rb +7 -11
- data/lib/compass/version.rb +10 -13
- data/lib/compass/watcher/compiler.rb +59 -0
- data/lib/compass/watcher/project_watcher.rb +111 -0
- data/lib/compass/watcher/watch.rb +33 -0
- data/lib/compass/watcher.rb +11 -0
- data/lib/compass.rb +2 -2
- data/test/fixtures/sprites/public/images/numeric/200.png +0 -0
- data/test/fixtures/stylesheets/busted_font_urls/config.rb +32 -0
- data/test/fixtures/stylesheets/busted_font_urls/css/screen.css +7 -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 +11 -0
- data/test/fixtures/stylesheets/busted_font_urls/tmp/screen.css +7 -0
- data/test/fixtures/stylesheets/busted_image_urls/tmp/screen.css +9 -0
- data/test/fixtures/stylesheets/compass/css/animation-with-legacy-ie.css +33 -0
- data/test/fixtures/stylesheets/compass/css/animation.css +33 -0
- data/test/fixtures/stylesheets/compass/css/background-clip.css +5 -0
- data/test/fixtures/stylesheets/compass/css/background-origin.css +15 -0
- data/test/fixtures/stylesheets/compass/css/background-size.css +24 -0
- data/test/fixtures/stylesheets/compass/css/columns.css +27 -63
- data/test/fixtures/stylesheets/compass/css/flexbox.css +121 -0
- data/test/fixtures/stylesheets/compass/css/fonts.css +1 -1
- data/test/fixtures/stylesheets/compass/css/gradients.css +64 -36
- data/test/fixtures/stylesheets/compass/css/grid_background.css +7 -14
- data/test/fixtures/stylesheets/compass/css/hyphenation.css +4 -2
- data/test/fixtures/stylesheets/compass/css/lists.css +5 -5
- data/test/fixtures/stylesheets/compass/css/pie.css +0 -3
- data/test/fixtures/stylesheets/compass/css/regions.css +4 -2
- data/test/fixtures/stylesheets/compass/css/selection.css +13 -0
- data/test/fixtures/stylesheets/compass/css/sprites.css +251 -250
- data/test/fixtures/stylesheets/compass/css/text_shadow.css +6 -6
- data/test/fixtures/stylesheets/compass/css/transition.css +6 -0
- data/test/fixtures/stylesheets/compass/css/units.css +30 -0
- data/test/fixtures/stylesheets/compass/css/user-interface.css +22 -1
- data/test/fixtures/stylesheets/compass/css/utilities.css +15 -0
- data/test/fixtures/stylesheets/compass/css/vertical_rhythm.css +177 -8
- data/test/fixtures/stylesheets/compass/images/flag-s5b4f509715.png +0 -0
- data/test/fixtures/stylesheets/compass/sass/animation-with-legacy-ie.scss +19 -0
- data/test/fixtures/stylesheets/compass/sass/animation.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/background-clip.scss +4 -2
- data/test/fixtures/stylesheets/compass/sass/background-origin.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/background-size.scss +12 -0
- data/test/fixtures/stylesheets/compass/sass/columns.scss +9 -9
- data/test/fixtures/stylesheets/compass/sass/flexbox.scss +44 -0
- data/test/fixtures/stylesheets/compass/sass/gradients.sass +31 -0
- data/test/fixtures/stylesheets/compass/sass/selection.scss +13 -0
- data/test/fixtures/stylesheets/compass/sass/transition.scss +1 -1
- data/test/fixtures/stylesheets/compass/sass/units.scss +45 -0
- data/test/fixtures/stylesheets/compass/sass/user-interface.scss +13 -1
- data/test/fixtures/stylesheets/compass/sass/utilities.scss +10 -0
- data/test/fixtures/stylesheets/compass/sass/vertical_rhythm.scss +208 -7
- data/test/fixtures/stylesheets/envtest/css/env.css +8 -0
- data/test/fixtures/stylesheets/envtest/sass/env.scss +16 -0
- data/test/fixtures/stylesheets/envtest/tmp/env.css +14 -0
- data/test/fixtures/stylesheets/valid/css/simple.css +4 -0
- data/test/helpers/diff.rb +1 -1
- data/test/integrations/compass_test.rb +23 -14
- data/test/integrations/sprites_test.rb +305 -63
- data/test/test_helper.rb +5 -15
- data/test/units/command_line_test.rb +0 -2
- data/test/units/compass_module_test.rb +1 -1
- data/test/units/configuration_test.rb +12 -0
- data/test/units/regressions_test.rb +8 -8
- data/test/units/sass_extensions_test.rb +2 -0
- data/test/units/sass_extenstions/gradients_test.rb +33 -0
- data/test/units/sprites/image_test.rb +5 -0
- data/test/units/sprites/images_test.rb +46 -0
- data/test/units/sprites/layout_test.rb +29 -4
- data/test/units/watcher/compiler_test.rb +39 -0
- data/test/units/watcher/project_watcher_test.rb +73 -0
- data/test/units/watcher/watch_test.rb +42 -0
- metadata +171 -236
- checksums.yaml +0 -7
- data/frameworks/blueprint/stylesheets/_blueprint.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_buttons.scss +0 -101
- data/frameworks/blueprint/stylesheets/blueprint/_colors.scss +0 -36
- data/frameworks/blueprint/stylesheets/blueprint/_debug.scss +0 -28
- data/frameworks/blueprint/stylesheets/blueprint/_fancy-type.scss +0 -88
- data/frameworks/blueprint/stylesheets/blueprint/_form.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_grid.scss +0 -258
- data/frameworks/blueprint/stylesheets/blueprint/_ie.scss +0 -111
- data/frameworks/blueprint/stylesheets/blueprint/_interaction.scss +0 -66
- data/frameworks/blueprint/stylesheets/blueprint/_link-icons.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/_liquid.scss +0 -152
- data/frameworks/blueprint/stylesheets/blueprint/_print.scss +0 -86
- data/frameworks/blueprint/stylesheets/blueprint/_reset.scss +0 -3
- data/frameworks/blueprint/stylesheets/blueprint/_rtl.scss +0 -121
- data/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss +0 -52
- data/frameworks/blueprint/stylesheets/blueprint/_typography.scss +0 -90
- data/frameworks/blueprint/stylesheets/blueprint/_utilities.scss +0 -37
- data/frameworks/blueprint/stylesheets/blueprint/reset/_utilities.scss +0 -83
- data/frameworks/blueprint/templates/basic/grid.png +0 -0
- data/frameworks/blueprint/templates/basic/ie.sass +0 -4
- data/frameworks/blueprint/templates/basic/manifest.rb +0 -30
- data/frameworks/blueprint/templates/basic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/basic/print.sass +0 -4
- data/frameworks/blueprint/templates/basic/screen.sass +0 -12
- data/frameworks/blueprint/templates/buttons/buttons/cross.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/key.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons/tick.png +0 -0
- data/frameworks/blueprint/templates/buttons/buttons.sass +0 -49
- data/frameworks/blueprint/templates/buttons/manifest.rb +0 -17
- data/frameworks/blueprint/templates/link_icons/link_icons/doc.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/email.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/external.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/feed.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/im.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/pdf.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/visited.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons/xls.png +0 -0
- data/frameworks/blueprint/templates/link_icons/link_icons.sass +0 -13
- data/frameworks/blueprint/templates/link_icons/manifest.rb +0 -23
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +0 -16
- data/frameworks/blueprint/templates/project/manifest.rb +0 -30
- data/frameworks/blueprint/templates/project/partials/_base.sass +0 -11
- data/frameworks/blueprint/templates/project/print.sass +0 -8
- data/frameworks/blueprint/templates/project/screen.sass +0 -46
- data/frameworks/blueprint/templates/semantic/grid.png +0 -0
- data/frameworks/blueprint/templates/semantic/ie.sass +0 -16
- data/frameworks/blueprint/templates/semantic/manifest.rb +0 -33
- data/frameworks/blueprint/templates/semantic/partials/_base.sass +0 -10
- data/frameworks/blueprint/templates/semantic/partials/_form.sass +0 -6
- data/frameworks/blueprint/templates/semantic/partials/_page.sass +0 -17
- data/frameworks/blueprint/templates/semantic/partials/_two_col.sass +0 -38
- data/frameworks/blueprint/templates/semantic/print.sass +0 -5
- data/frameworks/blueprint/templates/semantic/screen.sass +0 -14
- data/lib/compass/commands/generate_grid_background.rb +0 -96
- data/lib/compass/grid_builder.rb +0 -102
- data/test/fixtures/stylesheets/blueprint/config.rb +0 -14
- data/test/fixtures/stylesheets/blueprint/css/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/print.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/screen.css +0 -815
- data/test/fixtures/stylesheets/blueprint/css/single-imports/buttons.css +0 -56
- data/test/fixtures/stylesheets/blueprint/css/single-imports/colors.css +0 -80
- data/test/fixtures/stylesheets/blueprint/css/single-imports/debug.css +0 -11
- data/test/fixtures/stylesheets/blueprint/css/single-imports/fancy-type.css +0 -30
- data/test/fixtures/stylesheets/blueprint/css/single-imports/form.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/grid.css +0 -435
- data/test/fixtures/stylesheets/blueprint/css/single-imports/ie.css +0 -76
- data/test/fixtures/stylesheets/blueprint/css/single-imports/interaction.css +0 -46
- data/test/fixtures/stylesheets/blueprint/css/single-imports/link-icons.css +0 -40
- data/test/fixtures/stylesheets/blueprint/css/single-imports/liquid.css +0 -651
- data/test/fixtures/stylesheets/blueprint/css/single-imports/print.css +0 -60
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset-utilities.css +0 -75
- data/test/fixtures/stylesheets/blueprint/css/single-imports/reset.css +0 -42
- data/test/fixtures/stylesheets/blueprint/css/single-imports/rtl.css +0 -437
- data/test/fixtures/stylesheets/blueprint/css/single-imports/scaffolding.css +0 -45
- data/test/fixtures/stylesheets/blueprint/css/single-imports/typography.css +0 -146
- data/test/fixtures/stylesheets/blueprint/css/single-imports/utilities.css +0 -35
- data/test/fixtures/stylesheets/blueprint/images/grid.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/doc.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/email.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/external.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/feed.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/im.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/pdf.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/visited.png +0 -0
- data/test/fixtures/stylesheets/blueprint/images/link_icons/xls.png +0 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +0 -18
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/buttons.scss +0 -4
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/colors.scss +0 -34
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/debug.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/fancy-type.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/form.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/grid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/ie.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/interaction.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/link-icons.scss +0 -13
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/liquid.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/print.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset-utilities.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/reset.scss +0 -1
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/rtl.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/scaffolding.scss +0 -5
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/typography.scss +0 -3
- data/test/fixtures/stylesheets/blueprint/sass/single-imports/utilities.scss +0 -3
- data/test/fixtures/stylesheets/compass/images/flag-s4798b5a210.png +0 -0
- data/test/units/compass_png_test.rb +0 -46
|
@@ -2,6 +2,7 @@ require 'fileutils'
|
|
|
2
2
|
require 'pathname'
|
|
3
3
|
require 'compass/commands/base'
|
|
4
4
|
require 'compass/commands/update_project'
|
|
5
|
+
require 'compass/watcher'
|
|
5
6
|
require 'sass/plugin'
|
|
6
7
|
|
|
7
8
|
module Compass
|
|
@@ -25,131 +26,28 @@ module Compass
|
|
|
25
26
|
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
|
-
|
|
29
|
-
def report_on_instances(type, options = {})
|
|
30
|
-
@@runs ||= 0
|
|
31
|
-
@@runs += 1
|
|
32
|
-
@@object_id_tracker ||= {}
|
|
33
|
-
@@object_id_tracker[type] ||= []
|
|
34
|
-
GC.start
|
|
35
|
-
sleep options.fetch(:gc_pause, 1)
|
|
36
|
-
count = ObjectSpace.each_object(type) do |obj|
|
|
37
|
-
if options.fetch(:verbose, true)
|
|
38
|
-
if @@runs > 2
|
|
39
|
-
if !@@object_id_tracker[type].include?(obj.object_id)
|
|
40
|
-
begin
|
|
41
|
-
puts obj.inspect
|
|
42
|
-
rescue
|
|
43
|
-
end
|
|
44
|
-
puts "#{obj.class.name}:#{obj.object_id}"
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
@@object_id_tracker[type] << obj.object_id
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
puts "#{type}: #{count} instances."
|
|
51
|
-
end
|
|
52
|
-
end
|
|
29
|
+
|
|
53
30
|
class WatchProject < UpdateProject
|
|
54
31
|
|
|
55
32
|
register :watch
|
|
56
33
|
|
|
57
34
|
attr_accessor :last_update_time, :last_sass_files
|
|
58
35
|
|
|
59
|
-
include MemoryDebugger
|
|
60
|
-
|
|
61
36
|
def perform
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
37
|
+
# '.' assumes you are in the executing directory. so get the full path to the directory
|
|
38
|
+
if options[:project_name] == '.'
|
|
39
|
+
Compass.configuration.project_path = Dir.pwd
|
|
65
40
|
end
|
|
41
|
+
|
|
42
|
+
project_watcher = Compass::Watcher::ProjectWatcher.new(Compass.configuration.project_path, Compass.configuration.watches, options, options[:poll])
|
|
66
43
|
|
|
67
|
-
|
|
68
|
-
recompile
|
|
69
|
-
|
|
70
|
-
require 'fssm'
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if options[:poll]
|
|
74
|
-
require "fssm/backends/polling"
|
|
75
|
-
# have to silence the ruby warning about chaning a constant.
|
|
76
|
-
stderr, $stderr = $stderr, StringIO.new
|
|
77
|
-
FSSM::Backends.const_set("Default", FSSM::Backends::Polling)
|
|
78
|
-
$stderr = stderr
|
|
79
|
-
end
|
|
80
|
-
|
|
81
|
-
action = FSSM::Backends::Default.to_s == "FSSM::Backends::Polling" ? "polling" : "watching"
|
|
82
|
-
|
|
83
|
-
puts ">>> Compass is #{action} for changes. Press Ctrl-C to Stop."
|
|
44
|
+
puts ">>> Compass is watching for changes. Press Ctrl-C to Stop."
|
|
84
45
|
$stdout.flush
|
|
46
|
+
|
|
47
|
+
project_watcher.compile
|
|
48
|
+
project_watcher.watch!
|
|
85
49
|
|
|
86
|
-
begin
|
|
87
|
-
FSSM.monitor do |monitor|
|
|
88
|
-
Compass.configuration.sass_load_paths.each do |load_path|
|
|
89
|
-
load_path = load_path.root if load_path.respond_to?(:root)
|
|
90
|
-
next unless load_path.is_a? String
|
|
91
|
-
monitor.path load_path do |path|
|
|
92
|
-
path.glob '**/*.s[ac]ss'
|
|
93
50
|
|
|
94
|
-
path.update &method(:recompile)
|
|
95
|
-
path.delete {|base, relative| remove_obsolete_css(base,relative); recompile(base, relative)}
|
|
96
|
-
path.create &method(:recompile)
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
Compass.configuration.watches.each do |glob, callback|
|
|
100
|
-
monitor.path Compass.configuration.project_path do |path|
|
|
101
|
-
path.glob glob
|
|
102
|
-
path.update do |base, relative|
|
|
103
|
-
puts ">>> Change detected to: #{relative}"
|
|
104
|
-
$stdout.flush
|
|
105
|
-
callback.call(base, relative)
|
|
106
|
-
end
|
|
107
|
-
path.create do |base, relative|
|
|
108
|
-
puts ">>> New file detected: #{relative}"
|
|
109
|
-
$stdout.flush
|
|
110
|
-
callback.call(base, relative)
|
|
111
|
-
end
|
|
112
|
-
path.delete do |base, relative|
|
|
113
|
-
puts ">>> File Removed: #{relative}"
|
|
114
|
-
$stdout.flush
|
|
115
|
-
callback.call(base, relative)
|
|
116
|
-
end
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
end
|
|
121
|
-
rescue FSSM::CallbackError => e
|
|
122
|
-
# FSSM catches exit? WTF.
|
|
123
|
-
if e.message =~ /exit/
|
|
124
|
-
exit
|
|
125
|
-
end
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def remove_obsolete_css(base = nil, relative = nil)
|
|
130
|
-
compiler = new_compiler_instance(:quiet => true)
|
|
131
|
-
sass_files = compiler.sass_files
|
|
132
|
-
deleted_sass_files = (last_sass_files || []) - sass_files
|
|
133
|
-
deleted_sass_files.each do |deleted_sass_file|
|
|
134
|
-
css_file = compiler.corresponding_css_file(deleted_sass_file)
|
|
135
|
-
remove(css_file) if File.exists?(css_file)
|
|
136
|
-
end
|
|
137
|
-
self.last_sass_files = sass_files
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
def recompile(base = nil, relative = nil)
|
|
141
|
-
@memory_cache.reset! if @memory_cache
|
|
142
|
-
compiler = new_compiler_instance(:quiet => true, :loud => [:identical, :overwrite, :create])
|
|
143
|
-
if file = compiler.out_of_date?
|
|
144
|
-
begin
|
|
145
|
-
puts ">>> Change detected at "+Time.now.strftime("%T")+" to: #{relative || compiler.relative_stylesheet_name(file)}"
|
|
146
|
-
$stdout.flush
|
|
147
|
-
compiler.run
|
|
148
|
-
GC.start
|
|
149
|
-
rescue StandardError => e
|
|
150
|
-
::Compass::Exec::Helpers.report_error(e, options)
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
51
|
end
|
|
154
52
|
|
|
155
53
|
class << self
|
data/lib/compass/commands.rb
CHANGED
|
@@ -3,7 +3,7 @@ end
|
|
|
3
3
|
|
|
4
4
|
require 'compass/commands/registry'
|
|
5
5
|
|
|
6
|
-
%w(base
|
|
6
|
+
%w(base project_base default help list_frameworks
|
|
7
7
|
update_project watch_project create_project clean_project extension_command
|
|
8
8
|
imports installer_command print_version project_stats stamp_pattern
|
|
9
9
|
sprite validate_project write_configuration interactive unpack_extension
|
data/lib/compass/compiler.rb
CHANGED
|
@@ -19,6 +19,12 @@ module Compass
|
|
|
19
19
|
self.sass_options[:compass] ||= {}
|
|
20
20
|
self.sass_options[:compass][:logger] = self.logger
|
|
21
21
|
self.sass_options[:compass][:environment] = Compass.configuration.environment
|
|
22
|
+
reset_staleness_checker!
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def reset_staleness_checker!
|
|
26
|
+
self.staleness_checker = nil
|
|
27
|
+
#Sass::Plugin::StalenessChecker.dependencies_cache = {}
|
|
22
28
|
self.staleness_checker = Sass::Plugin::StalenessChecker.new(sass_options)
|
|
23
29
|
end
|
|
24
30
|
|
|
@@ -134,6 +140,7 @@ module Compass
|
|
|
134
140
|
|
|
135
141
|
# Compile one Sass file
|
|
136
142
|
def compile(sass_filename, css_filename)
|
|
143
|
+
start_time = end_time = nil
|
|
137
144
|
css_content = logger.red do
|
|
138
145
|
timed do
|
|
139
146
|
engine(sass_filename, css_filename).render
|
|
@@ -152,7 +159,7 @@ module Compass
|
|
|
152
159
|
def engine(sass_filename, css_filename)
|
|
153
160
|
syntax = (sass_filename =~ /\.(s[ac]ss)$/) && $1.to_sym || :sass
|
|
154
161
|
opts = sass_options.merge(:filename => sass_filename, :css_filename => css_filename, :syntax => syntax)
|
|
155
|
-
Sass::Engine.new(
|
|
162
|
+
Sass::Engine.new(open(sass_filename).read, opts)
|
|
156
163
|
end
|
|
157
164
|
|
|
158
165
|
# Place the syntax error into the target css file,
|
|
@@ -33,6 +33,8 @@ module Compass
|
|
|
33
33
|
nil
|
|
34
34
|
elsif config.is_a?(Compass::Configuration::Data)
|
|
35
35
|
config
|
|
36
|
+
elsif config.instance_of?(Hash)
|
|
37
|
+
Compass::Configuration::Data.new(filename, config)
|
|
36
38
|
elsif config.respond_to?(:read)
|
|
37
39
|
filename ||= config.to_s if config.is_a?(Pathname)
|
|
38
40
|
Compass::Configuration::FileData.new_from_string(config.read, filename, defaults)
|
|
@@ -61,6 +61,14 @@ module Compass::Exec::ProjectOptionsParser
|
|
|
61
61
|
opts.on('--no-line-comments', :NONE, 'Disable line comments.') do
|
|
62
62
|
self.options[:line_comments] = false
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
opts.on('--http-path HTTP_PATH', 'Set this to the root of your project when deployed') do |http_path|
|
|
66
|
+
self.options[:http_path] = http_path
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
opts.on('--generated-images-path GENERATED_IMAGES_PATH', 'The path where you generate your images') do |generated_images_path|
|
|
70
|
+
self.options[:generated_images_path] = generated_images_path
|
|
71
|
+
end
|
|
64
72
|
end
|
|
65
73
|
|
|
66
74
|
end
|
data/lib/compass/logger.rb
CHANGED
|
@@ -9,6 +9,7 @@ module Compass
|
|
|
9
9
|
ACTION_COLORS = {
|
|
10
10
|
:error => :red,
|
|
11
11
|
:warning => :yellow,
|
|
12
|
+
:info => :green,
|
|
12
13
|
:compile => :green,
|
|
13
14
|
:overwrite => :yellow,
|
|
14
15
|
:create => :green,
|
|
@@ -76,6 +77,7 @@ module Compass
|
|
|
76
77
|
# Emit a log message
|
|
77
78
|
def log(msg)
|
|
78
79
|
puts msg
|
|
80
|
+
$stdout.flush
|
|
79
81
|
end
|
|
80
82
|
|
|
81
83
|
# add padding to the left of an action that was performed.
|
|
@@ -33,7 +33,7 @@ module Compass::SassExtensions::Functions::CrossBrowserSupport
|
|
|
33
33
|
Sass::Script::Bool.new(needed)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
%w(webkit moz o ms svg pie css2
|
|
36
|
+
%w(webkit moz o ms svg pie css2).each do |prefix|
|
|
37
37
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
|
38
38
|
# Syntactic sugar to apply the given prefix
|
|
39
39
|
# -moz($arg) is the same as calling prefix(-moz, $arg)
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
module Compass::SassExtensions::Functions::Env
|
|
2
|
+
|
|
2
3
|
def compass_env
|
|
3
4
|
Sass::Script::String.new((options[:compass][:environment] || "development").to_s)
|
|
4
5
|
end
|
|
6
|
+
|
|
7
|
+
def current_time(format)
|
|
8
|
+
time = Time.now.strftime(format.to_s)
|
|
9
|
+
|
|
10
|
+
Sass::Script::String.new(time.to_s)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
alias :current_date :current_time
|
|
14
|
+
|
|
15
|
+
def current_source_file
|
|
16
|
+
Sass::Script::String.new(options[:filename].to_s)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def current_output_file
|
|
20
|
+
Sass::Script::String.new(options[:css_filename].to_s)
|
|
21
|
+
end
|
|
22
|
+
|
|
5
23
|
end
|
|
@@ -10,6 +10,7 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
10
10
|
def initialize(color, stop = nil)
|
|
11
11
|
unless Sass::Script::Color === color ||
|
|
12
12
|
Sass::Script::Funcall === color ||
|
|
13
|
+
(Sass::Script::String === color && color.value == "currentColor")||
|
|
13
14
|
(Sass::Script::String === color && color.value == "transparent")
|
|
14
15
|
raise Sass::SyntaxError, "Expected a color. Got: #{color}"
|
|
15
16
|
end
|
|
@@ -21,6 +22,31 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
21
22
|
def inspect
|
|
22
23
|
to_s
|
|
23
24
|
end
|
|
25
|
+
|
|
26
|
+
def self.color_to_svg_s(c)
|
|
27
|
+
# svg doesn't support the "transparent" keyword; we need to manually
|
|
28
|
+
# refactor it into "transparent black"
|
|
29
|
+
if c.is_a?(Sass::Script::String) && c.value == "transparent"
|
|
30
|
+
"black"
|
|
31
|
+
elsif c.is_a?(Sass::Script::String)
|
|
32
|
+
c.value.dup
|
|
33
|
+
else
|
|
34
|
+
self.color_to_s(c.with(:alpha => 1))
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def self.color_to_svg_alpha(c)
|
|
39
|
+
# svg doesn't support the "transparent" keyword; we need to manually
|
|
40
|
+
# refactor it into "transparent black"
|
|
41
|
+
if c.is_a?(Sass::Script::String) && c.value == "transparent"
|
|
42
|
+
0
|
|
43
|
+
elsif c.is_a?(Sass::Script::String) && c.value == "currentColor"
|
|
44
|
+
1
|
|
45
|
+
else
|
|
46
|
+
c.alpha
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
24
50
|
def self.color_to_s(c)
|
|
25
51
|
if c.is_a?(Sass::Script::String)
|
|
26
52
|
c.value.dup
|
|
@@ -53,7 +79,7 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
53
79
|
def standardized_prefix(prefix)
|
|
54
80
|
class_eval %Q{
|
|
55
81
|
def to_#{prefix}(options = self.options)
|
|
56
|
-
Sass::Script::String.new("-#{prefix}-\#{
|
|
82
|
+
Sass::Script::String.new("-#{prefix}-\#{to_s_prefixed(options)}")
|
|
57
83
|
end
|
|
58
84
|
}
|
|
59
85
|
end
|
|
@@ -108,22 +134,14 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
108
134
|
s << color_stops.to_s(options)
|
|
109
135
|
s << ")"
|
|
110
136
|
end
|
|
137
|
+
|
|
138
|
+
def to_s_prefixed(options = self.options)
|
|
139
|
+
to_s(options)
|
|
140
|
+
end
|
|
111
141
|
|
|
112
142
|
standardized_prefix :webkit
|
|
113
143
|
standardized_prefix :moz
|
|
114
144
|
standardized_prefix :o
|
|
115
|
-
|
|
116
|
-
def to_owg(options = self.options)
|
|
117
|
-
args = [
|
|
118
|
-
grad_point(position || _center_position),
|
|
119
|
-
Sass::Script::String.new("0"),
|
|
120
|
-
grad_point(position || _center_position),
|
|
121
|
-
grad_end_position(color_stops, Sass::Script::Bool.new(true)),
|
|
122
|
-
grad_color_stops(color_stops)
|
|
123
|
-
]
|
|
124
|
-
args.each {|a| a.options = options}
|
|
125
|
-
Sass::Script::String.new("-webkit-gradient(radial, #{args.join(', ')})")
|
|
126
|
-
end
|
|
127
145
|
|
|
128
146
|
def to_svg(options = self.options)
|
|
129
147
|
# XXX Add shape support if possible
|
|
@@ -143,23 +161,48 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
143
161
|
class LinearGradient < Sass::Script::Literal
|
|
144
162
|
include Gradient
|
|
145
163
|
|
|
146
|
-
attr_accessor :color_stops, :position_or_angle
|
|
164
|
+
attr_accessor :color_stops, :position_or_angle, :legacy
|
|
147
165
|
|
|
148
166
|
def children
|
|
149
167
|
[color_stops, position_or_angle].compact
|
|
150
168
|
end
|
|
151
169
|
|
|
152
|
-
def initialize(position_or_angle, color_stops)
|
|
170
|
+
def initialize(position_or_angle, color_stops, legacy=false)
|
|
153
171
|
unless color_stops.value.size >= 2
|
|
154
172
|
raise Sass::SyntaxError, "At least two color stops are required for a linear-gradient"
|
|
155
173
|
end
|
|
156
174
|
self.position_or_angle = position_or_angle
|
|
157
175
|
self.color_stops = color_stops
|
|
176
|
+
self.legacy = legacy
|
|
158
177
|
end
|
|
159
178
|
|
|
160
|
-
def
|
|
179
|
+
def to_s_prefixed(options = self.options)
|
|
161
180
|
s = "linear-gradient("
|
|
162
|
-
|
|
181
|
+
if legacy
|
|
182
|
+
s << position_or_angle.to_s(options) << ", " if position_or_angle
|
|
183
|
+
else
|
|
184
|
+
s << convert_to_or_from_legacy(position_or_angle, options) << ", " if position_or_angle
|
|
185
|
+
end
|
|
186
|
+
s << color_stops.to_s(options)
|
|
187
|
+
s << ")"
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
def convert_to_or_from_legacy(position_or_angle, options = self.options)
|
|
191
|
+
input = if position_or_angle.is_a?(Sass::Script::Number)
|
|
192
|
+
position_or_angle
|
|
193
|
+
else
|
|
194
|
+
Sass::Script::List.new(position_or_angle.to_s.split(' ').map {|s| Sass::Script::String.new(s) }, :space)
|
|
195
|
+
end
|
|
196
|
+
return convert_angle_from_offical(input).to_s(options)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def to_s(options = self.options)
|
|
200
|
+
s = 'linear-gradient('
|
|
201
|
+
if legacy
|
|
202
|
+
s << convert_to_or_from_legacy(position_or_angle, options) << ", " if position_or_angle
|
|
203
|
+
else
|
|
204
|
+
s << position_or_angle.to_s(options) << ", " if position_or_angle
|
|
205
|
+
end
|
|
163
206
|
s << color_stops.to_s(options)
|
|
164
207
|
s << ")"
|
|
165
208
|
end
|
|
@@ -177,16 +220,6 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
177
220
|
end
|
|
178
221
|
end
|
|
179
222
|
|
|
180
|
-
# Output the original webkit gradient syntax
|
|
181
|
-
def to_owg(options = self.options)
|
|
182
|
-
args = []
|
|
183
|
-
args << grad_point(position_or_angle || Sass::Script::String.new("top"))
|
|
184
|
-
args << linear_end_position(position_or_angle, color_stops)
|
|
185
|
-
args << grad_color_stops(color_stops)
|
|
186
|
-
args.each{|a| a.options = options}
|
|
187
|
-
Sass::Script::String.new("-webkit-gradient(linear, #{args.join(', ')})")
|
|
188
|
-
end
|
|
189
|
-
|
|
190
223
|
def to_svg(options = self.options)
|
|
191
224
|
linear_svg_gradient(color_stops, position_or_angle || Sass::Script::String.new("top"))
|
|
192
225
|
end
|
|
@@ -203,6 +236,29 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
203
236
|
end
|
|
204
237
|
|
|
205
238
|
module Functions
|
|
239
|
+
|
|
240
|
+
def convert_angle_from_offical(deg)
|
|
241
|
+
if deg.is_a?(Sass::Script::Number)
|
|
242
|
+
return Sass::Script::Number.new((deg.value.to_f - 450).abs % 360, ['deg'])
|
|
243
|
+
else
|
|
244
|
+
args = deg.value
|
|
245
|
+
direction = []
|
|
246
|
+
if args[0] == Sass::Script::String.new('to')
|
|
247
|
+
if args.size < 2
|
|
248
|
+
direction = args
|
|
249
|
+
else
|
|
250
|
+
direction << opposite_position(args[1])
|
|
251
|
+
end
|
|
252
|
+
else
|
|
253
|
+
direction << Sass::Script::String.new('to')
|
|
254
|
+
args.each do |pos|
|
|
255
|
+
direction << opposite_position(pos)
|
|
256
|
+
end
|
|
257
|
+
end
|
|
258
|
+
return Sass::Script::String.new(direction.join(' '))
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
206
262
|
# given a position list, return a corresponding position in percents
|
|
207
263
|
# otherwise, returns the original argument
|
|
208
264
|
def grad_point(position)
|
|
@@ -252,6 +308,8 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
252
308
|
ColorStop.new(*arg.value)
|
|
253
309
|
elsif Sass::Script::String === arg && arg.value == "transparent"
|
|
254
310
|
ColorStop.new(arg)
|
|
311
|
+
elsif Sass::Script::String === arg && arg.value == "currentColor"
|
|
312
|
+
ColorStop.new(arg)
|
|
255
313
|
else
|
|
256
314
|
raise Sass::SyntaxError, "Not a valid color stop: #{arg.class.name}: #{arg}"
|
|
257
315
|
end
|
|
@@ -286,7 +344,7 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
286
344
|
RadialGradient.new(position_or_angle, shape_and_size, send(:color_stops, *color_stops))
|
|
287
345
|
end
|
|
288
346
|
|
|
289
|
-
def
|
|
347
|
+
def _build_linear_gradient(position_or_angle, *color_stops)
|
|
290
348
|
if color_stop?(position_or_angle)
|
|
291
349
|
color_stops.unshift(position_or_angle)
|
|
292
350
|
position_or_angle = nil
|
|
@@ -300,9 +358,19 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
300
358
|
if color_stops.size == 1 && (stops = list_of_color_stops?(color_stops.first))
|
|
301
359
|
color_stops = stops
|
|
302
360
|
end
|
|
361
|
+
return [position_or_angle, color_stops]
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
def _linear_gradient(position_or_angle, *color_stops)
|
|
365
|
+
position_or_angle, color_stops = _build_linear_gradient(position_or_angle, *color_stops)
|
|
303
366
|
LinearGradient.new(position_or_angle, send(:color_stops, *color_stops))
|
|
304
367
|
end
|
|
305
368
|
|
|
369
|
+
def _linear_gradient_legacy(position_or_angle, *color_stops)
|
|
370
|
+
position_or_angle, color_stops = _build_linear_gradient(position_or_angle, *color_stops)
|
|
371
|
+
LinearGradient.new(position_or_angle, send(:color_stops, *color_stops), true)
|
|
372
|
+
end
|
|
373
|
+
|
|
306
374
|
# returns color-stop() calls for use in webkit.
|
|
307
375
|
def grad_color_stops(color_list)
|
|
308
376
|
stops = color_stops_in_percentages(color_list).map do |stop, color|
|
|
@@ -495,7 +563,11 @@ module Compass::SassExtensions::Functions::GradientSupport
|
|
|
495
563
|
# color_stops = array of: [stop, color]
|
|
496
564
|
def color_stops_svg(color_stops)
|
|
497
565
|
color_stops.each.map{ |stop, color|
|
|
498
|
-
|
|
566
|
+
s = %{<stop offset="#{stop.to_s}"}
|
|
567
|
+
s << %{ stop-color="#{ColorStop.color_to_svg_s(color)}"}
|
|
568
|
+
alpha = ColorStop.color_to_svg_alpha(color)
|
|
569
|
+
s << %{ stop-opacity="#{alpha}"} if alpha != 1
|
|
570
|
+
s << "/>"
|
|
499
571
|
}.join
|
|
500
572
|
end
|
|
501
573
|
|
|
@@ -45,9 +45,10 @@ module Compass::SassExtensions::Functions::ImageSize
|
|
|
45
45
|
private
|
|
46
46
|
|
|
47
47
|
def image_dimensions(image_file)
|
|
48
|
+
image_file = image_file.respond_to?(:value) ? image_file.value : image_file
|
|
48
49
|
options[:compass] ||= {}
|
|
49
50
|
options[:compass][:image_dimensions] ||= {}
|
|
50
|
-
options[:compass][:image_dimensions][image_file
|
|
51
|
+
options[:compass][:image_dimensions][image_file] = ImageProperties.new(image_path_for_size(image_file)).size
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def image_path_for_size(image_file)
|
|
@@ -5,6 +5,18 @@ module Compass::SassExtensions::Functions::Math
|
|
|
5
5
|
end
|
|
6
6
|
Sass::Script::Functions.declare :pi, []
|
|
7
7
|
|
|
8
|
+
def random(*args)
|
|
9
|
+
value = if args.length == 1
|
|
10
|
+
rand(args.pop.value)
|
|
11
|
+
else
|
|
12
|
+
range = (args.first.value..args.last.value).to_a
|
|
13
|
+
range[rand(range.length)]
|
|
14
|
+
end
|
|
15
|
+
Sass::Script::Number.new(value)
|
|
16
|
+
end
|
|
17
|
+
Sass::Script::Functions.declare :random, [:limit]
|
|
18
|
+
Sass::Script::Functions.declare :random, [:start, :limit]
|
|
19
|
+
|
|
8
20
|
def sin(number)
|
|
9
21
|
trig(:sin, number)
|
|
10
22
|
end
|
|
@@ -20,7 +32,7 @@ module Compass::SassExtensions::Functions::Math
|
|
|
20
32
|
end
|
|
21
33
|
Sass::Script::Functions.declare :tan, [:number]
|
|
22
34
|
|
|
23
|
-
def e
|
|
35
|
+
def e
|
|
24
36
|
Sass::Script::Number.new(Math::E)
|
|
25
37
|
end
|
|
26
38
|
Sass::Script::Functions.declare :e, []
|