Sha256: 05474c6da0c4df42934c7a9c9971ed0bb6b9d5da250617fa0f2d1d602a40e1cf
Contents?: true
Size: 1.3 KB
Versions: 8
Compression:
Stored size: 1.3 KB
Contents
require "sprockets" module Middleman::CoreExtensions::Sprockets class << self def registered(app) app.set :js_compressor, false app.map "/#{app.js_dir}" do run JavascriptEnvironment.new(app) end # app.map "/#{app.css_dir}" do # run StylesheetEnvironment.new(app) # end end alias :included :registered end class MiddlemanEnvironment < Sprockets::Environment def initialize(app) full_path = app.views full_path = File.join(app.root, app.views) unless app.views.include?(app.root) super File.expand_path(full_path) end end class JavascriptEnvironment < MiddlemanEnvironment def initialize(app) super # Disable css unregister_processor "text/css", ::Sprockets::DirectiveProcessor self.js_compressor = app.settings.js_compressor # configure search paths append_path app.js_dir end end # class StylesheetEnvironment < MiddlemanEnvironment # def initialize(app) # super # # # Disable js # unregister_processor "application/javascript", ::Sprockets::DirectiveProcessor # # # configure search paths # stylesheets_path = File.join(File.expand_path(app.views), app.css_dir) # append_path stylesheets_path # end # end end
Version data entries
8 entries across 8 versions & 1 rubygems