lib/smallvictories/compiler.rb in smallvictories-0.0.17 vs lib/smallvictories/compiler.rb in smallvictories-0.0.18

- old
+ new

@@ -1,11 +1,9 @@ require 'sprockets' require 'autoprefixer-rails' require 'liquid' require 'premailer' -require 'sprite_factory' -require 'rails-sass-images' module SmallVictories class Compiler attr_accessor :config @@ -23,14 +21,10 @@ def compile_html liquid if config.compile_html end - def compile_sprite - sprite if config.compile_sprite - end - def inline_html premail end def liquid @@ -84,11 +78,10 @@ environment.gzip = true environment.logger = SmallVictories.logger environment.js_compressor = options[:js_compressor] || :uglify environment.css_compressor = options[:css_compressor] || :sass end - RailsSassImages.install(sprockets) sprockets.append_path('.') bundles.each do |bundle| begin if assets = sprockets.find_asset(bundle.first) @@ -151,29 +144,8 @@ end rescue => e SmallVictories.logger.error "Inline Error\n#{e}" end end - end - - def sprite - SmallVictories.logger.debug "Spriting" - sprite_directory = File.join(config.full_source_path, config.source_sprite) - return unless Dir.exists?(sprite_directory) - css = "@import 'rails-sass-images';\n" - css += SpriteFactory.run!(sprite_directory, - output_image: File.join(config.full_source_path, config.destination_sprite_file), - style: :scss, - margin: 20, - layout: :vertical, - nocss: true, - sanitizer: true) do |images| - images.map do |image_name, image_data| - ".sprite-#{image_name} { background-image: url('#{config.destination_sprite_file}'); background-size: (image-width('#{File.join(config.destination_sprite_file)}')/2) auto; background-repeat: no-repeat; background-position: (#{image_data[:cssx]}px/-2) (#{image_data[:cssy]}px/-2); height: (#{image_data[:cssh]}px/2) + 1px; width: (#{image_data[:cssw]}px/2) + 1px;}" - end.join("\n") - end - FileUtils.cp(File.join(config.full_source_path, config.destination_sprite_file), File.join(config.full_destination_path, config.destination_sprite_file)) - File.open(File.join(config.full_source_path, config.destination_sprite_style), 'w') { |file| file.write(css) } - SmallVictories.logger.info "compiled #{File.join(config.destination, config.destination_sprite_style)}" end end end