Sha256: 398f31281caf0d6bd2ac13fc68337751dcc73dccebe3d01b79d1f6b225fea300

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new("test" => "assets:compile") do |test|
  test.pattern = "test/**/*_test.rb"
end

Rake::TestTask.new("test:unit" => "assets:compile") do |test|
  test.pattern = "test/unit/**/*_test.rb"
end

Rake::TestTask.new("test:integration" => "assets:compile") do |test|
  test.pattern = "test/integration/**/*_test.rb"
end

task default: :test

namespace :assets do
  stylesheets_src_path = "src/stylesheets"
  stylesheets_dst_path = "app/views/flipflop/stylesheets"
  stylesheet_file = "_flipflop.css"
  stylesheet_dst_path = stylesheets_dst_path + "/" + stylesheet_file

  task :compile do
    require "bundler/setup"
    require "flipflop"
    require "sprockets"
    require "bootstrap"

    environment = Sprockets::Environment.new
    environment.append_path stylesheets_src_path
    environment.append_path Bootstrap.stylesheets_path
    environment.css_compressor = :scss
    File.write(stylesheet_dst_path, environment[stylesheet_file])
  end

  task :watch do
    require "listen"

    listener = Listen.to(stylesheets_src_path, only: /\.scss$/) do
      Rake::Task["assets:compile"].execute
    end

    $stderr.puts("Watching #{stylesheets_src_path} for changes...")

    listener.start

    Rake::Task["assets:compile"].execute
    sleep
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
flipflop-2.8.0 Rakefile
flipflop-2.7.1 Rakefile
flipflop-2.7.0 Rakefile
flipflop-2.6.0 Rakefile
flipflop-2.5.0 Rakefile
flipflop-2.4.0 Rakefile
flipflop-2.3.1 Rakefile
flipflop-2.3.0 Rakefile