lorem ext
This commit is contained in:
parent
65c8dda565
commit
3da3a2acc8
|
@ -74,10 +74,8 @@ module Middleman
|
|||
end
|
||||
|
||||
# GZIP assets and pages during build
|
||||
Middleman::Extensions.register(:gzip) do
|
||||
require "middleman-more/extensions/gzip"
|
||||
Middleman::Extensions::Gzip
|
||||
end
|
||||
Middleman::Extensions::Gzip.register
|
||||
|
||||
# AssetHash appends a hash of the file contents to the assets filename
|
||||
# to avoid browser caches failing to update to your new content.
|
||||
|
@ -97,7 +95,7 @@ module Middleman
|
|||
# Lorem provides a handful of helpful prototyping methods to generate
|
||||
# words, paragraphs, fake images, names and email addresses.
|
||||
require "middleman-more/extensions/lorem"
|
||||
Middleman::Application.register Middleman::Extensions::Lorem
|
||||
Middleman::Extensions::Lorem.new(app)
|
||||
|
||||
# AutomaticImageSizes inspects the images used in your dynamic templates
|
||||
# and automatically adds width and height attributes to their HTML
|
||||
|
|
|
@ -25,7 +25,7 @@ module Middleman
|
|||
# Process resources in order: binary images and fonts, then SVG, then JS/CSS.
|
||||
# This is so by the time we get around to the text files (which may reference
|
||||
# images and fonts) the static assets' hashes are already calculated.
|
||||
rack_client = ::Rack::Test::Session.new(@app.class.to_rack_app)
|
||||
rack_client = ::Rack::Test::Session.new(app.class.to_rack_app)
|
||||
resources.sort_by do |a|
|
||||
if %w(.svg).include? a.ext
|
||||
0
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
require 'zlib'
|
||||
require 'stringio'
|
||||
require 'find'
|
||||
|
||||
module Middleman::Extensions
|
||||
|
||||
# This extension Gzips assets and pages when building.
|
||||
|
@ -21,6 +17,10 @@ module Middleman::Extensions
|
|||
def initialize(app, options_hash={})
|
||||
super
|
||||
|
||||
require 'zlib'
|
||||
require 'stringio'
|
||||
require 'find'
|
||||
|
||||
gzip_ext = self
|
||||
|
||||
app.after_build do |builder|
|
||||
|
|
|
@ -3,26 +3,12 @@ module Middleman
|
|||
module Extensions
|
||||
|
||||
# Lorem helper
|
||||
module Lorem
|
||||
|
||||
# Setup extension
|
||||
class << self
|
||||
|
||||
# Once registered
|
||||
def registered(app)
|
||||
# Include methods
|
||||
app.send :include, InstanceMethods
|
||||
end
|
||||
|
||||
alias :included :registered
|
||||
end
|
||||
|
||||
# Lorem extension instance methods
|
||||
module InstanceMethods
|
||||
class Lorem < ::Middleman::Extension
|
||||
helpers do
|
||||
# Access to the Lorem object
|
||||
# @return [Middleman::Extensions::Lorem::LoremObject]
|
||||
def lorem
|
||||
@_lorem ||= LoremObject.new
|
||||
LoremObject
|
||||
end
|
||||
|
||||
# Return a placeholder image using placekitten.com
|
||||
|
@ -60,7 +46,8 @@ module Middleman
|
|||
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
class LoremObject
|
||||
module LoremObject
|
||||
class << self
|
||||
# Words for use in lorem text
|
||||
WORDS = %w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)
|
||||
|
||||
|
@ -182,8 +169,6 @@ module Middleman
|
|||
src
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Pick a random item from a given range
|
||||
# @param [Range] range
|
||||
# @return [Object]
|
||||
|
@ -194,4 +179,5 @@ module Middleman
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue