tdreyno-middleman 0.5.4 → 0.5.5

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
@@ -2,8 +2,6 @@
2
2
 
3
3
  # Require app
4
4
  require 'templater'
5
- require "yui/compressor"
6
- require "sprockets"
7
5
 
8
6
  MIDDLEMAN_BUILDER = true
9
7
  require File.join(File.dirname(__FILE__), '..', 'lib', 'middleman')
@@ -6,6 +6,8 @@ require 'sinatra/base'
6
6
  require 'sprockets'
7
7
  require File.join(File.dirname(__FILE__), 'middleman', 'sprockets_ext')
8
8
 
9
+ require "yui/compressor"
10
+
9
11
  # Include content_for support
10
12
  require File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra-content-for', 'lib', 'sinatra', 'content_for')
11
13
 
@@ -68,6 +70,23 @@ class Middleman < Sinatra::Base
68
70
  Compass.configure_sass_plugin!
69
71
  end
70
72
 
73
+ configure :build do
74
+ Compass.configuration do |config|
75
+ config.output_style = :compressed
76
+ end
77
+
78
+ module Minified
79
+ module Javascript
80
+ include ::Haml::Filters::Base
81
+ def render_with_options(text, options)
82
+ compressor = ::YUI::JavaScriptCompressor.new(:munge => true)
83
+ data = compressor.compress(text.rstrip.gsub("\n", "\n "))
84
+ %Q{<script type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}>#{data.chomp}</script>}
85
+ end
86
+ end
87
+ end
88
+ end
89
+
71
90
  # CSS files
72
91
  get %r{/(.*).css} do |path|
73
92
  content_type 'text/css', :charset => 'utf-8'
@@ -108,7 +127,6 @@ class Middleman < Sinatra::Base
108
127
  result || pass
109
128
  end
110
129
 
111
-
112
130
  get %r{/(.*\.xml)} do |path|
113
131
  content_type 'text/xml', :charset => 'utf-8'
114
132
  haml(path.to_sym, :layout => false)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{middleman}
8
- s.version = "0.5.4"
8
+ s.version = "0.5.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Thomas Reynolds"]
12
- s.date = %q{2009-09-19}
12
+ s.date = %q{2009-09-21}
13
13
  s.email = %q{tdreyno@gmail.com}
14
14
  s.executables = ["mm-init", "mm-build", "mm-server"]
15
15
  s.extra_rdoc_files = [
@@ -42,6 +42,7 @@ Gem::Specification.new do |s|
42
42
  "spec/fixtures/sample/public/stylesheets/static.css",
43
43
  "spec/fixtures/sample/views/_partial.haml",
44
44
  "spec/fixtures/sample/views/index.haml",
45
+ "spec/fixtures/sample/views/inline-js.haml",
45
46
  "spec/fixtures/sample/views/layout.haml",
46
47
  "spec/fixtures/sample/views/markaby.mab",
47
48
  "spec/fixtures/sample/views/maruku.maruku",
@@ -54,4 +54,8 @@ describe "Builder" do
54
54
  it "should not build partial files" do
55
55
  File.exists?("#{@root_dir}/build/_partial.html").should be_false
56
56
  end
57
+
58
+ it "should minify inline javascript" do
59
+ File.readlines("#{@root_dir}/build/inline-js.html").length.should == 9
60
+ end
57
61
  end
@@ -0,0 +1,7 @@
1
+ :javascript
2
+ ;(function() {
3
+ this;
4
+ should();
5
+ all.be();
6
+ on = { one: line };
7
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdreyno-middleman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Reynolds
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-19 00:00:00 -07:00
12
+ date: 2009-09-21 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -129,6 +129,7 @@ files:
129
129
  - spec/fixtures/sample/public/stylesheets/static.css
130
130
  - spec/fixtures/sample/views/_partial.haml
131
131
  - spec/fixtures/sample/views/index.haml
132
+ - spec/fixtures/sample/views/inline-js.haml
132
133
  - spec/fixtures/sample/views/layout.haml
133
134
  - spec/fixtures/sample/views/markaby.mab
134
135
  - spec/fixtures/sample/views/maruku.maruku