pinion 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pinion/asset.rb CHANGED
@@ -3,10 +3,9 @@ require "set"
3
3
  require "time"
4
4
 
5
5
  require "pinion/conversion"
6
+ require "pinion/environment"
6
7
 
7
8
  module Pinion
8
- def self.environment() (defined?(RACK_ENV) && RACK_ENV) || ENV["RACK_ENV"] || "development" end
9
-
10
9
  class Asset
11
10
  class << self
12
11
  attr_reader :watch_directories, :cached_assets
@@ -1,5 +1,6 @@
1
1
  require "set"
2
2
 
3
+ require "pinion/environment"
3
4
  require "pinion/error"
4
5
 
5
6
  module Pinion
@@ -73,7 +74,8 @@ module Pinion
73
74
  require_gem "sass"
74
75
  render do |file_contents, context|
75
76
  load_paths = context[:load_paths].to_a || []
76
- Sass::Engine.new(file_contents, :syntax => :scss, :load_paths => load_paths).render
77
+ style = Pinion.environment == "production" ? :compressed : :nested
78
+ Sass::Engine.new(file_contents, :syntax => :scss, :load_paths => load_paths, :style => style).render
77
79
  end
78
80
  watch do |path, context|
79
81
  context[:load_paths] ||= Set.new
@@ -85,7 +87,8 @@ module Pinion
85
87
  require_gem "sass"
86
88
  render do |file_contents, context|
87
89
  load_paths = context[:load_paths].to_a || []
88
- Sass::Engine.new(file_contents, :syntax => :sass, :load_paths => load_paths).render
90
+ style = Pinion.environment == "production" ? :compressed : :nested
91
+ Sass::Engine.new(file_contents, :syntax => :sass, :load_paths => load_paths, :style => style).render
89
92
  end
90
93
  watch do |path, context|
91
94
  context[:load_paths] ||= Set.new
@@ -0,0 +1,3 @@
1
+ module Pinion
2
+ def self.environment() (defined?(RACK_ENV) && RACK_ENV) || ENV["RACK_ENV"] || "development" end
3
+ end
data/lib/pinion/server.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "pinion/asset"
2
2
  require "pinion/bundle"
3
3
  require "pinion/compiled_asset"
4
- require "pinion/static_asset"
5
4
  require "pinion/conversion"
5
+ require "pinion/environment"
6
6
  require "pinion/error"
7
+ require "pinion/static_asset"
7
8
 
8
9
  module Pinion
9
10
  class Server
@@ -1,3 +1,3 @@
1
1
  module Pinion
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pinion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-07-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rack
16
- requirement: &15960660 !ruby/object:Gem::Requirement
16
+ requirement: &13260160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15960660
24
+ version_requirements: *13260160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &15959300 !ruby/object:Gem::Requirement
27
+ requirement: &13259440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *15959300
35
+ version_requirements: *13259440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &15958080 !ruby/object:Gem::Requirement
38
+ requirement: &13258580 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *15958080
46
+ version_requirements: *13258580
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: scope
49
- requirement: &15956220 !ruby/object:Gem::Requirement
49
+ requirement: &13257780 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *15956220
57
+ version_requirements: *13257780
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rack-test
60
- requirement: &15955100 !ruby/object:Gem::Requirement
60
+ requirement: &13256400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *15955100
68
+ version_requirements: *13256400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: coffee-script
71
- requirement: &15947620 !ruby/object:Gem::Requirement
71
+ requirement: &13255340 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *15947620
79
+ version_requirements: *13255340
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: dedent
82
- requirement: &15946140 !ruby/object:Gem::Requirement
82
+ requirement: &13245040 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *15946140
90
+ version_requirements: *13245040
91
91
  description: ! 'Pinion is a Rack application that you can use to compile and serve
92
92
  assets (such as Javascript and CSS).
93
93
 
@@ -107,6 +107,7 @@ files:
107
107
  - lib/pinion/bundle_type.rb
108
108
  - lib/pinion/server.rb
109
109
  - lib/pinion/conversion.rb
110
+ - lib/pinion/environment.rb
110
111
  - lib/pinion/static_asset.rb
111
112
  - lib/pinion/version.rb
112
113
  homepage: https://github.com/ooyala/pinion