Sha256: 24a60d6ac16b848590c062c266e02cbcbfb6d826b4cd4ba5207db053e2160d3f

Contents?: true

Size: 957 Bytes

Versions: 70

Compression:

Stored size: 957 Bytes

Contents

require 'open-uri'
require 'fileutils'
require 'tempfile'

task :styles do
  begin
    FileUtils.mkdir 'tmp'
    download_deps
    compile_less
  ensure
    FileUtils.remove_dir 'tmp'
  end
end

def deps
  {
    'markdown-preview' =>
      'markdown-preview/master/styles/markdown-preview.less',
    'syntax-variables' =>
      'template-syntax/master/stylesheets/syntax-variables.less',
    'colors' =>
      'template-syntax/master/stylesheets/colors.less'
  }
end

def download_deps
  host = 'https://raw.githubusercontent.com/atom/'

  deps.each do |k, v|
    File.open("tmp/#{k}.less", 'w') do |out_file|
      open(host + v, 'r') do |in_file|
        out_file << in_file.read
      end
    end
  end
end

def compile_less
  tmp = 'tmp/github.css'
  out_file = 'assets/atom.css'
  `lessc tmp/markdown-preview.less #{tmp}`

  File.open out_file, 'w' do |file|
    css = File.read(tmp).gsub(/markdown-preview/, 'markdown-body')
    file << css
  end
end

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
brief-1.17.14 tasks/styles.rake
brief-1.17.13 tasks/styles.rake
brief-1.17.12 tasks/styles.rake
brief-1.17.11 tasks/styles.rake
brief-1.17.10 tasks/styles.rake
brief-1.17.9 tasks/styles.rake
brief-1.17.8 tasks/styles.rake
brief-1.17.7 tasks/styles.rake
brief-1.17.5 tasks/styles.rake
brief-1.17.4 tasks/styles.rake
brief-1.17.3 tasks/styles.rake
brief-1.17.2 tasks/styles.rake
brief-1.17.1 tasks/styles.rake
brief-1.17.0 tasks/styles.rake
brief-1.16.2 tasks/styles.rake
brief-1.16.1 tasks/styles.rake
brief-1.16.0 tasks/styles.rake
brief-1.15.5 tasks/styles.rake
brief-1.15.4 tasks/styles.rake
brief-1.15.3 tasks/styles.rake