mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
use build? helper
This commit is contained in:
parent
01eccafde2
commit
142e6b9f24
5 changed files with 5 additions and 4 deletions
|
@ -16,7 +16,7 @@ module Middleman::Features::CacheBuster
|
|||
|
||||
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
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -14,7 +14,7 @@ module Middleman::Renderers::Sass
|
|||
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
|
||||
|
|
|
@ -14,6 +14,7 @@ module Middleman
|
|||
super(option, value, &nil)
|
||||
end
|
||||
|
||||
# Convenience method to check if we're in build mode
|
||||
def build?; environment == :build; end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue