Sha256: ce30beaaefe3eeb18f0703b0902bda14e68d5d8e53f80e4f4f46f4ecc21711fd

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

require "fileutils"
require "pathname"

# Specify path to checked out Foundation repo
FOUNDATION_REPO_PATH = Pathname.new("/Users/mark/Projects/foundation")

# Specify which files need to be concatenated and in what order
FOUNDATION_CSS = %w(globals.css typography.css grid.css ui.css forms.css orbit.css reveal.css mobile.css)
FOUNDATION_JS = %w(jquery.reveal.js jquery.orbit-1.3.0.js forms.jquery.js jquery.customforms.js jquery.placeholder.min.js app.js)

# Clean out vendor/assets
ASSET_PATH = Pathname.new(File.dirname(__FILE__)).join("vendor", "assets")
FileUtils.remove_dir ASSET_PATH, :force => true

# Recreate vendor/assets
FileUtils.mkdir_p ASSET_PATH.join("stylesheets", "foundation")
FileUtils.mkdir_p ASSET_PATH.join("javascripts", "foundation")
FileUtils.mkdir_p ASSET_PATH.join("images", "foundation")

# Create SCSS file, so we can usage image-url() helper
File.open(ASSET_PATH.join("stylesheets", "foundation", "index.css"), "w") do |file|
  file << "/*\n"
  FOUNDATION_CSS.each do |filename|
    file << "*= require 'foundation/#{filename.gsub('.css','')}'\n"
    css_file = File.open(FOUNDATION_REPO_PATH.join("stylesheets", filename))
    File.open(ASSET_PATH.join("stylesheets", "foundation", "#{filename}.scss"), "w") do |include_file|
      include_file << css_file.read.gsub(/url\('?\.\.\/images\/([^\)']+)'?\)/, 'image-url("foundation/\1")')
      include_file << "\n\n"
    end
  end
  file << "*/"
end

# Create JS file
File.open(ASSET_PATH.join("javascripts", "foundation", "index.js"), "w") do |file|
  FOUNDATION_JS.each do |filename|    
    file << "//= require 'foundation/#{File.basename(filename.gsub('.js',''))}'\n"
    js_file = File.open(FOUNDATION_REPO_PATH.join("javascripts", filename))
    File.open(ASSET_PATH.join("javascripts", "foundation", filename), "w") do |include_file|
      include_file << js_file.read
      include_file << "\n\n"
    end
  end
end

# Copy Images
FileUtils.cp_r FOUNDATION_REPO_PATH.join("images/."), ASSET_PATH.join("images", "foundation")

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zurb-foundation-2.1.4 build.rb
zurb-foundation-2.1.3.1 build.rb
zurb-foundation-2.1.3 build.rb
zurb-foundation-2.1.2 build.rb