chriseppstein-compass 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -1,6 +1,50 @@
1
1
  COMPASS CHANGELOG
2
2
  =================
3
3
 
4
+ 0.8.3 (July 06, 2009)
5
+ ---------------------
6
+
7
+ Note: Compass now depends on the stable release of haml with version 2.2.0 or greater.
8
+
9
+ ### Compass Core
10
+
11
+ * A new helper function `stylesheet_url(path)` can now be used to refer to assets that are relative to the css directory.
12
+ [Commit](http://github.com/chriseppstein/compass/commit/ff5c8500144272ee2b94271b06cce1690cbbc000).
13
+ * Cross browser ellipsis mixin is now available. Use `compass -p ellipsis` to install it into your project since it
14
+ requires some additional assets.
15
+ [Commit](http://github.com/chriseppstein/compass/commit/3d909ceda997bdcde2aec09bd72e646098389e7d).
16
+
17
+ ### Blueprint
18
+
19
+ * The +colruler mixin now accepts an argument for the color.
20
+ [Commit](http://github.com/chriseppstein/compass/commit/a5393bbb7cd0941ab8add5be188aea1d6f9d4b00)
21
+ by [Thomas Reynolds][tdreyno].
22
+
23
+ ### Extensions
24
+
25
+ * A bug was fixed related to how javascript installation as part of an extension manifest.
26
+ [Commit](http://github.com/chriseppstein/compass/commit/a5393bbb7cd0941ab8add5be188aea1d6f9d4b00)
27
+ by [dturnbull][dturnbull].
28
+ * When installing a file, the :like option can now be set to have it installed into the
29
+ same location as what it is like. E.g. `file 'foo.xml', :like => :css` will install
30
+ the foo.xml file into the top level of the project's css directory.
31
+ [Commit](http://github.com/chriseppstein/compass/commit/21cfce33db81e185ce5517818844a9849b5a836e).
32
+
33
+ ### Configuration
34
+ * Setting `http_images_path` to `:relative` is now **deprecated**. Instead, please set `relative_assets` to
35
+ `true`.
36
+ [Commit](http://github.com/chriseppstein/compass/commit/956c437fe9ffaad08b6b34d91b6cfb80d6121a2f).
37
+ * New configuration option `http_path` can be used to set the project's path relative to the server's root.
38
+ Defaults to "/". The http paths to images, stylesheets, and javascripts are now assumed to be relative to that
39
+ path but can be overridden using the `http_images_path`, `http_css_path`, `http_javascripts_path`.
40
+ [Commit](http://github.com/chriseppstein/compass/commit/6555ab3952ae37d736d54f43ee7053c2a88f4a69).
41
+
42
+ ### Command Line
43
+
44
+ * A new command line option `--relative-assets` can be used to cause links to assets generated
45
+ via compass helper functions to be relative to the target css file.
46
+ [Commit](http://github.com/chriseppstein/compass/commit/956c437fe9ffaad08b6b34d91b6cfb80d6121a2f).
47
+
4
48
  0.8.2 (July 04, 2009)
5
49
  ---------------------
6
50
 
@@ -396,3 +440,4 @@ Almost definitely. Please let me know if you encounter any problems and I'll get
396
440
  [perezd]: http://github.com/perezd
397
441
  [Chrononaut]: http://github.com/Chrononaut
398
442
  [rails_template]: http://github.com/chriseppstein/compass/raw/4e7e51e2c5491851f66c77abf3f15194f2f8fb8d/lib/compass/app_integration/rails/templates/compass-install-rails.rb
443
+ [dturnbull]: http://github.com/dturnbull
data/REVISION CHANGED
@@ -1 +1 @@
1
- 1de07d81dc07bca446b9f911aff76243c1e515a2
1
+ 51743bdb5b4d9835f3bde134219fab68bfaafc5f
data/Rakefile CHANGED
@@ -45,7 +45,7 @@ begin
45
45
  gemspec.description = "Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS."
46
46
  gemspec.authors = ["Chris Eppstein"]
47
47
  gemspec.has_rdoc = false
48
- gemspec.add_dependency('haml-edge', '>= 2.1.12')
48
+ gemspec.add_dependency('haml', '>= 2.2.0')
49
49
  gemspec.files = []
50
50
  gemspec.files << "CHANGELOG.markdown"
51
51
  gemspec.files << "README.markdown"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 2
3
2
  :major: 0
4
3
  :minor: 8
4
+ :patch: 3
@@ -4,5 +4,4 @@ css_dir = "stylesheets"
4
4
  sass_dir = "src"
5
5
  images_dir = "images"
6
6
  output_style = :compact
7
- # To enable relative image paths using the images_url() function:
8
- http_images_path = :relative
7
+ relative_assets = true
@@ -4,6 +4,5 @@ css_dir = "stylesheets"
4
4
  sass_dir = "src"
5
5
  images_dir = "images"
6
6
  output_style = :compact
7
- # To enable relative image paths using the images_url() function:
8
- # http_images_path = :relative
9
- http_images_path = :relative
7
+ relative_assets = true
8
+
@@ -4,5 +4,4 @@ css_dir = "stylesheets"
4
4
  sass_dir = "src"
5
5
  images_dir = "images"
6
6
  output_style = :compact
7
- # To enable relative image paths using the images_url() function:
8
- http_images_path = :relative
7
+ relative_assets = true
@@ -4,5 +4,4 @@ css_dir = "stylesheets"
4
4
  sass_dir = "src"
5
5
  images_dir = "images"
6
6
  output_style = :compact
7
- # To enable relative image paths using the images_url() function:
8
- http_images_path = :relative
7
+ relative_assets = true
@@ -3,6 +3,7 @@
3
3
  @import yui/modules/base.sass
4
4
  @import blueprint/modules/grid.sass
5
5
  @import blueprint/modules/scaffolding.sass
6
+ @import compass/utilities/text/ellipsis.sass
6
7
 
7
8
  html
8
9
  +yui-base
@@ -67,6 +68,12 @@ h2
67
68
  +outer-table-borders(2px, #151A99)
68
69
  +inner-table-borders(1px, #151A99)
69
70
 
71
+ #ellipsis
72
+ +column(8, true)
73
+ td
74
+ width: 50%
75
+ +ellipsis
76
+
70
77
  #floats
71
78
  +column(16)
72
79
  .clearfix-example
@@ -139,6 +139,10 @@
139
139
  %td.numeric.even 15.5
140
140
  %td.numeric.odd 16.0
141
141
  %td.numeric.even 17.5
142
+ #ellipsis
143
+ .example
144
+ %h2 Ellipsis
145
+ %p This long text is truncated at the end of the first line. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
142
146
  #floats
143
147
  .example
144
148
  %h2 Floats
@@ -151,9 +151,9 @@
151
151
  :border-right #{!border_width} solid #{!border_color}
152
152
 
153
153
  // Mixin this to an hr to make a horizontal ruler across a column.
154
- =colruler
155
- :background #ddd
156
- :color #ddd
154
+ =colruler(!border_color = #ddd)
155
+ :background= !border_color
156
+ :color= !border_color
157
157
  :clear both
158
158
  :float none
159
159
  :width 100%
@@ -0,0 +1,13 @@
1
+ //
2
+ This technique, by [Justin Maxwell](http://code404.com/), was originally
3
+ published at http://mattsnider.com/css/css-string-truncation-with-ellipsis/
4
+ Firefox implementation by [Rikkert Koppes](http://www.rikkertkoppes.com/thoughts/2008/6/)
5
+
6
+ =ellipsis(!no_wrap = true)
7
+ @if !no_wrap
8
+ white-space: nowrap
9
+ overflow: hidden
10
+ text-overflow: ellipsis
11
+ -o-text-overflow: ellipsis
12
+ -ms-text-overflow: ellipsis
13
+ -moz-binding= stylesheet_url("xml/ellipsis.xml#ellipsis")
@@ -0,0 +1,6 @@
1
+ @import compass/utilities/text/ellipsis.sass
2
+
3
+ // You can delete this sass file if you want, it's just an example of how to use the ellipsis mixin.
4
+ // By default, ellipsis text is no-wrap. Pass false as the first argument if you don't want that.
5
+ .ellipsis
6
+ +ellipsis
@@ -0,0 +1,2 @@
1
+ file 'xml/ellipsis.xml', :like => :css
2
+ stylesheet 'ellipsis.sass'
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0"?>
2
+ <bindings
3
+ xmlns="http://www.mozilla.org/xbl"
4
+ xmlns:xbl="http://www.mozilla.org/xbl"
5
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
6
+ >
7
+ <binding id="ellipsis">
8
+ <content>
9
+ <xul:window>
10
+ <xul:description crop="end" xbl:inherits="value=xbl:text"><children/></xul:description>
11
+ </xul:window>
12
+ </content>
13
+ </binding>
14
+ </bindings>
@@ -7,13 +7,17 @@ module Compass
7
7
  ATTRIBUTES = [
8
8
  :project_type,
9
9
  :project_path,
10
+ :http_path,
10
11
  :css_dir,
11
12
  :sass_dir,
12
13
  :images_dir,
13
14
  :javascripts_dir,
14
15
  :output_style,
15
16
  :environment,
17
+ :relative_assets,
16
18
  :http_images_path,
19
+ :http_stylesheets_path,
20
+ :http_javascripts_path,
17
21
  :additional_import_paths,
18
22
  :sass_options
19
23
  ]
@@ -44,6 +48,7 @@ module Compass
44
48
  self.additional_import_paths ||= []
45
49
  self.additional_import_paths += @added_import_paths
46
50
  end
51
+ issue_deprecation_warnings
47
52
  end
48
53
 
49
54
  def set_all(options)
@@ -91,12 +96,27 @@ module Compass
91
96
  "images"
92
97
  end
93
98
 
94
- def default_http_images_path
95
- "/#{images_dir}"
99
+ def default_http_path
100
+ "/"
96
101
  end
97
102
 
98
- def comment_for_http_images_path
99
- "# To enable relative image paths using the images_url() function:\n# http_images_path = :relative\n"
103
+ def comment_for_http_path
104
+ "# Set this to the root of your project when deployed:\n"
105
+ end
106
+
107
+ def relative_assets?
108
+ # the http_images_path is deprecated, but here for backwards compatibility.
109
+ relative_assets || http_images_path == :relative
110
+ end
111
+
112
+ def comment_for_relative_assets
113
+ unless relative_assets
114
+ %q{# To enable relative paths to assets via compass helper functions. Uncomment:
115
+ # relative_assets = true
116
+ }
117
+ else
118
+ ""
119
+ end
100
120
  end
101
121
 
102
122
  def default_output_style
@@ -123,6 +143,12 @@ module Compass
123
143
  end
124
144
  end
125
145
 
146
+ def root_relative(path)
147
+ hp = http_path || default_http_path
148
+ hp = hp[0..-2] if hp[-1..-1] == "/"
149
+ "#{hp}/#{path}"
150
+ end
151
+
126
152
  def add_import_path(*paths)
127
153
  # The @added_import_paths variable works around an issue where
128
154
  # the additional_import_paths gets overwritten during parse
@@ -249,6 +275,12 @@ module Compass
249
275
  self.required_libraries = []
250
276
  end
251
277
 
278
+ def issue_deprecation_warnings
279
+ if http_images_path == :relative
280
+ puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths."
281
+ end
282
+ end
283
+
252
284
  def require(lib)
253
285
  required_libraries << lib
254
286
  super
data/lib/compass/exec.rb CHANGED
@@ -184,6 +184,10 @@ END
184
184
  self.options[:output_style] = style
185
185
  end
186
186
 
187
+ opts.on('--relative-assets', :NONE, 'Make compass asset helpers generate relative urls to assets.') do
188
+ self.options[:relative_assets] = true
189
+ end
190
+
187
191
  opts.separator ''
188
192
  opts.separator 'General Options:'
189
193
 
@@ -31,7 +31,7 @@ module Compass
31
31
  # Initializes the project to work with compass
32
32
  def init
33
33
  dirs = manifest.map do |entry|
34
- File.dirname(send("install_location_for_#{entry.type}", entry.to))
34
+ File.dirname(send("install_location_for_#{entry.type}", entry.to, entry.options))
35
35
  end
36
36
 
37
37
  if manifest.has_stylesheet?
@@ -90,9 +90,16 @@ module Compass
90
90
  def self.installer(type, &locator)
91
91
  locator ||= lambda{|to| to}
92
92
  loc_method = "install_location_for_#{type}".to_sym
93
- define_method loc_method, locator
93
+ define_method("simple_#{loc_method}", locator)
94
+ define_method(loc_method) do |to, options|
95
+ if options[:like] && options[:like] != type
96
+ send("install_location_for_#{options[:like]}", to, options)
97
+ else
98
+ send("simple_#{loc_method}", to)
99
+ end
100
+ end
94
101
  define_method "install_#{type}" do |from, to, options|
95
- copy templatize(from), targetize(send(loc_method, to))
102
+ copy templatize(from), targetize(send(loc_method, to, options))
96
103
  end
97
104
  end
98
105
 
@@ -100,11 +107,15 @@ module Compass
100
107
  "#{sass_dir}/#{pattern_name_as_dir}#{to}"
101
108
  end
102
109
 
110
+ installer :css do |to|
111
+ "#{css_dir}/#{to}"
112
+ end
113
+
103
114
  installer :image do |to|
104
115
  "#{images_dir}/#{to}"
105
116
  end
106
117
 
107
- installer :script do |to|
118
+ installer :javascript do |to|
108
119
  "#{javascripts_dir}/#{to}"
109
120
  end
110
121
 
@@ -1,4 +1,19 @@
1
- module Compass::SassExtensions::Functions::ImageUrl
1
+ module Compass::SassExtensions::Functions::Urls
2
+
3
+ def stylesheet_url(path)
4
+ # Compute the path to the stylesheet, either root relative or stylesheet relative
5
+ # or nil if the http_images_path is not set in the configuration.
6
+ http_stylesheets_path = if relative?
7
+ compute_relative_path(Compass.configuration.css_dir)
8
+ elsif Compass.configuration.http_stylesheets_path
9
+ Compass.configuration.http_stylesheets_path
10
+ else
11
+ Compass.configuration.root_relative(Compass.configuration.css_dir)
12
+ end
13
+
14
+ url("#{http_stylesheets_path}/#{path}")
15
+ end
16
+
2
17
  def image_url(path)
3
18
  path = path.value # get to the string value of the literal.
4
19
  # Short curcuit if they have provided an absolute url.
@@ -10,9 +25,11 @@ module Compass::SassExtensions::Functions::ImageUrl
10
25
  # Compute the path to the image, either root relative or stylesheet relative
11
26
  # or nil if the http_images_path is not set in the configuration.
12
27
  http_images_path = if relative?
13
- compute_relative_path
14
- else
28
+ compute_relative_path(Compass.configuration.images_dir)
29
+ elsif Compass.configuration.http_stylesheets_path
15
30
  Compass.configuration.http_images_path
31
+ else
32
+ Compass.configuration.root_relative(Compass.configuration.images_dir)
16
33
  end
17
34
 
18
35
  # Compute the real path to the image on the file stystem if the images_dir is set.
@@ -37,23 +54,30 @@ module Compass::SassExtensions::Functions::ImageUrl
37
54
  # prepend the asset host if there is one.
38
55
  path = "#{asset_host}#{'/' unless path[0..0] == "/"}#{path}" if asset_host
39
56
 
40
- Sass::Script::String.new("url(#{path})")
57
+ url(path)
58
+ end
59
+
60
+ # Emits a url, taking off any leading "./"
61
+ def url(url)
62
+ url = url.to_s
63
+ url = url[0..1] == "./" ? url[2..-1] : url
64
+ Sass::Script::String.new("url('#{url}')")
41
65
  end
42
66
 
43
67
  private
44
68
 
45
69
  def relative?
46
- Compass.configuration.http_images_path == :relative
70
+ Compass.configuration.relative_assets?
47
71
  end
48
72
 
49
73
  def absolute_path?(path)
50
74
  path[0..0] == "/" || path[0..3] == "http"
51
75
  end
52
76
 
53
- def compute_relative_path
77
+ def compute_relative_path(dir)
54
78
  if (target_css_file = options[:css_filename])
55
- images_path = File.join(Compass.configuration.project_path, Compass.configuration.images_dir)
56
- Pathname.new(images_path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s
79
+ path = File.join(Compass.configuration.project_path, dir)
80
+ Pathname.new(path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s
57
81
  end
58
82
  end
59
83
 
@@ -1,14 +1,14 @@
1
1
  module Compass::SassExtensions::Functions
2
2
  end
3
3
 
4
- ['selectors', 'enumerate', 'image_url', 'display', 'inline_image'].each do |func|
4
+ ['selectors', 'enumerate', 'urls', 'display', 'inline_image'].each do |func|
5
5
  require File.join(File.dirname(__FILE__), 'functions', func)
6
6
  end
7
7
 
8
8
  module Sass::Script::Functions
9
9
  include Compass::SassExtensions::Functions::Selectors
10
10
  include Compass::SassExtensions::Functions::Enumerate
11
- include Compass::SassExtensions::Functions::ImageUrl
11
+ include Compass::SassExtensions::Functions::Urls
12
12
  include Compass::SassExtensions::Functions::Display
13
13
  include Compass::SassExtensions::Functions::InlineImage
14
14
  end
@@ -13,14 +13,15 @@ class ConfigurationTest < Test::Unit::TestCase
13
13
  # Require any additional compass plugins here.
14
14
 
15
15
  project_type = :stand_alone
16
+ # Set this to the root of your project when deployed:
17
+ http_path = "/"
16
18
  css_dir = "css"
17
19
  sass_dir = "sass"
18
20
  images_dir = "img"
19
21
  javascripts_dir = "js"
20
22
  output_style = :nested
21
- # To enable relative image paths using the images_url() function:
22
- # http_images_path = :relative
23
- http_images_path = "/images"
23
+ # To enable relative paths to assets via compass helper functions. Uncomment:
24
+ # relative_assets = true
24
25
  CONFIG
25
26
 
26
27
  Compass.configuration.parse_string(contents, "test_parse")
@@ -65,6 +66,7 @@ class ConfigurationTest < Test::Unit::TestCase
65
66
 
66
67
  def test_additional_import_paths
67
68
  contents = <<-CONFIG
69
+ http_path = "/"
68
70
  project_path = "/home/chris/my_compass_project"
69
71
  css_dir = "css"
70
72
  additional_import_paths = ["../foo"]
@@ -81,11 +83,14 @@ class ConfigurationTest < Test::Unit::TestCase
81
83
  expected_serialization = <<EXPECTED
82
84
  # Require any additional compass plugins here.
83
85
  project_path = "/home/chris/my_compass_project"
86
+ # Set this to the root of your project when deployed:
87
+ http_path = "/"
84
88
  css_dir = "css"
85
- # To enable relative image paths using the images_url() function:
86
- # http_images_path = :relative
89
+ # To enable relative paths to assets via compass helper functions. Uncomment:
90
+ # relative_assets = true
87
91
  additional_import_paths = ["../foo", "/path/to/my/framework"]
88
92
  EXPECTED
93
+ assert_equal "/", Compass.configuration.http_path
89
94
  assert_equal expected_serialization, Compass.configuration.serialize
90
95
  end
91
96
 
@@ -101,10 +106,12 @@ EXPECTED
101
106
 
102
107
  expected_serialization = <<EXPECTED
103
108
  # Require any additional compass plugins here.
104
- # To enable relative image paths using the images_url() function:
105
- # http_images_path = :relative
109
+ # Set this to the root of your project when deployed:
110
+ # To enable relative paths to assets via compass helper functions. Uncomment:
111
+ # relative_assets = true
106
112
  sass_options = {:foo=>"bar"}
107
113
  EXPECTED
114
+
108
115
  assert_equal expected_serialization, Compass.configuration.serialize
109
116
  end
110
117
 
@@ -1,3 +1,3 @@
1
- .showgrid { background-image: url(http://assets2.example.com/images/grid.png?busted=true); }
1
+ .showgrid { background-image: url('http://assets2.example.com/images/grid.png?busted=true'); }
2
2
 
3
3
  .inlinegrid { background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAUEAYAAACv1qP4AAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAZ0lEQVRYw+3QwQ2AIBAFUTEUwI3+uzN7gDscsIgxEuO8An52J11X73OudfxMraXkzHfO3Y98nQEhA0IGhAwIGRAyIGRAyICQASEDQgaEDAgZEDIgZEDIgJABoZzSGK3tPuN9ERFP7Nw4fg+c5g8V1wAAAABJRU5ErkJggg=='); }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chriseppstein-compass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Eppstein
@@ -9,18 +9,18 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-04 00:00:00 -07:00
12
+ date: 2009-07-06 00:00:00 -07:00
13
13
  default_executable: compass
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: haml-edge
16
+ name: haml
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.1.12
23
+ version: 2.2.0
24
24
  version:
25
25
  description: Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS.
26
26
  email: chris@eppsteins.net
@@ -194,8 +194,12 @@ files:
194
194
  - frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass
195
195
  - frameworks/compass/stylesheets/compass/utilities/tables/_borders.sass
196
196
  - frameworks/compass/stylesheets/compass/utilities/tables/_scaffolding.sass
197
+ - frameworks/compass/stylesheets/compass/utilities/text/_ellipsis.sass
197
198
  - frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass
198
199
  - frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass
200
+ - frameworks/compass/templates/ellipsis/ellipsis.sass
201
+ - frameworks/compass/templates/ellipsis/manifest.rb
202
+ - frameworks/compass/templates/ellipsis/xml/ellipsis.xml
199
203
  - frameworks/compass/templates/project/ie.sass
200
204
  - frameworks/compass/templates/project/manifest.rb
201
205
  - frameworks/compass/templates/project/print.sass
@@ -247,9 +251,9 @@ files:
247
251
  - lib/compass/sass_extensions/functions.rb
248
252
  - lib/compass/sass_extensions/functions/display.rb
249
253
  - lib/compass/sass_extensions/functions/enumerate.rb
250
- - lib/compass/sass_extensions/functions/image_url.rb
251
254
  - lib/compass/sass_extensions/functions/inline_image.rb
252
255
  - lib/compass/sass_extensions/functions/selectors.rb
256
+ - lib/compass/sass_extensions/functions/urls.rb
253
257
  - lib/compass/sass_extensions/monkey_patches.rb
254
258
  - lib/compass/sass_extensions/monkey_patches/stylesheet_updating.rb
255
259
  - lib/compass/test_case.rb