Skip to content

Commit

Permalink
use build? helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tdreyno committed Jul 10, 2011
1 parent 01eccaf commit 142e6b9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/middleman/features/cache_buster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def registered(app)

if File.readable?(real_path_static)
http_path << "?" + File.mtime(real_path_static).strftime("%s")
elsif app.environment == :build
elsif app.build?
real_path_dynamic = File.join(app.root, app.build_dir, prefix, path)
http_path << "?" + File.mtime(real_path_dynamic).strftime("%s") if File.readable?(real_path_dynamic)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/middleman/features/live_reload.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Middleman::Features::LiveReload
class << self
def registered(app)
return unless Middleman::Server.environment == :development
return unless Middleman::Server.development?

begin
require 'livereload'
Expand Down
2 changes: 1 addition & 1 deletion lib/middleman/features/minify_javascript.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Middleman::Features::MinifyJavascript
class << self
def registered(app)
# Only do minification on build or prod mode
return unless [:build, :production].include? app.environment
return unless app.build? || app.production?

require "middleman/features/minify_javascript/rack"
app.use Middleman::Rack::MinifyJavascript
Expand Down
2 changes: 1 addition & 1 deletion lib/middleman/renderers/sass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SassPlusCSSFilenameTemplate < ::Tilt::SassTemplate
def sass_options
return super if basename.nil?

location_of_sass_file = if Middleman::Server.environment == :build
location_of_sass_file = if Middleman::Server.build?
File.join(Middleman::Server.root, Middleman::Server.build_dir)
else
Middleman::Server.views
Expand Down
1 change: 1 addition & 0 deletions lib/middleman/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def set(option, value=self, &block)
super(option, value, &nil)
end

# Convenience method to check if we're in build mode
def build?; environment == :build; end
end

Expand Down

0 comments on commit 142e6b9

Please sign in to comment.