require "middleman" require 'middleman-target' module Pullentity::Client::Helpers def javascript_include_tag(file) if target?(:pullentity) path = "/uploads/theme_asset/#{site_name}/theme/#{theme_name}/assets/#{file}" "" else super end end def stylesheet_link_tag(file) if target?(:pullentity) path = "/uploads/theme_asset/#{site_name}/theme/#{theme_name}/assets/#{file}" "" else super end end def test_data_include_tag unless target?(:pullentity) javascript_include_tag "test-data" end end def site_name hsh = YAML.load_file(location + "pullentity.yml") hsh["site"] end def theme_name hsh = YAML.load_file(location + "pullentity.yml") hsh["theme_name"] end def location @location ||= Pathname.new(Dir.pwd) end def asset_pathxxxx(file) if target?(:pullentity) 'yea' else super end end end module Pullentity::Client::MiddlemanConfig class << self def registered(app) app.helpers Pullentity::Client::Helpers app.set :site_name, site_name app.set :theme_name, theme_name app.compass_config do |config| # config is the Compass.configuration object config.output_style = :compact config.http_images_path = "/uploads/theme_asset/#{site_name}/theme/#{theme_name}/assets" end end def site_name hsh = YAML.load_file(location + "pullentity.yml") hsh["site"] end def theme_name hsh = YAML.load_file(location + "pullentity.yml") hsh["theme_name"] end def location @location ||= Pathname.new(Dir.pwd) end alias :included :registered end end ::Middleman::Extensions.register(:pullentity_config, Pullentity::Client::MiddlemanConfig)