added dummyhtml
This commit is contained in:
parent
f29cc5efaf
commit
227a7375e6
133 changed files with 9158 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
require 'fileutils'
|
||||
module Blueprint
|
||||
# path to the root Blueprint directory
|
||||
ROOT_PATH = File.join(File.expand_path(File.dirname(__FILE__)), "../../")
|
||||
# path to where the Blueprint CSS files are stored
|
||||
BLUEPRINT_ROOT_PATH = File.join(Blueprint::ROOT_PATH, 'blueprint')
|
||||
# path to where the Blueprint CSS raw CSS files are stored
|
||||
SOURCE_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, 'src')
|
||||
# path to where the Blueprint CSS generated test files are stored
|
||||
TEST_PATH = File.join(Blueprint::ROOT_PATH, 'tests')
|
||||
# path to the root of the Blueprint scripts
|
||||
LIB_PATH = File.join(Blueprint::ROOT_PATH, 'lib', 'blueprint')
|
||||
# path to where Blueprint plugins are stored
|
||||
PLUGINS_PATH = File.join(Blueprint::BLUEPRINT_ROOT_PATH, 'plugins')
|
||||
# settings YAML file where custom user settings are saved
|
||||
SETTINGS_FILE = File.join(Blueprint::ROOT_PATH, 'lib', 'settings.yml')
|
||||
# path to validator jar file to validate generated CSS files
|
||||
VALIDATOR_FILE = File.join(Blueprint::LIB_PATH, 'validate', 'css-validator.jar')
|
||||
# hash of compressed and source CSS files
|
||||
CSS_FILES = {
|
||||
'screen.css' => ['reset.css', 'typography.css', 'forms.css', 'grid.css'],
|
||||
'print.css' => ['print.css'],
|
||||
'ie.css' => ['ie.css']
|
||||
}
|
||||
|
||||
# default number of columns for Blueprint layout
|
||||
COLUMN_COUNT = 24
|
||||
# default column width (in pixels) for Blueprint layout
|
||||
COLUMN_WIDTH = 30
|
||||
# default gutter width (in pixels) for Blueprint layout
|
||||
GUTTER_WIDTH = 10
|
||||
|
||||
INPUT_PADDING = 5
|
||||
INPUT_BORDER = 1
|
||||
end
|
||||
|
||||
Dir["#{File.join(Blueprint::LIB_PATH)}/*"].each do |file|
|
||||
require "#{file}" if file =~ /\.rb$/ && file !~ /blueprint.rb/
|
||||
end
|
|
@ -0,0 +1,261 @@
|
|||
require 'yaml'
|
||||
require 'optparse'
|
||||
module Blueprint
|
||||
class Compressor
|
||||
TEST_FILES = ['index.html',
|
||||
'parts/elements.html',
|
||||
'parts/forms.html',
|
||||
'parts/grid.html',
|
||||
'parts/sample.html']
|
||||
|
||||
attr_accessor :namespace, :custom_css, :custom_layout, :semantic_classes, :project_name, :plugins
|
||||
attr_reader :custom_path, :loaded_from_settings, :destination_path, :script_name
|
||||
|
||||
# overridden setter method for destination_path
|
||||
# also sets custom_path flag on Blueprint::Compressor instance
|
||||
def destination_path=(path)
|
||||
@destination_path = path
|
||||
@custom_path = @destination_path != Blueprint::BLUEPRINT_ROOT_PATH
|
||||
end
|
||||
|
||||
# constructor
|
||||
def initialize
|
||||
# set up defaults
|
||||
@script_name = File.basename($0)
|
||||
@loaded_from_settings = false
|
||||
self.namespace = ""
|
||||
self.destination_path = Blueprint::BLUEPRINT_ROOT_PATH
|
||||
self.custom_layout = CustomLayout.new
|
||||
self.project_name = nil
|
||||
self.custom_css = {}
|
||||
self.semantic_classes = {}
|
||||
self.plugins = []
|
||||
|
||||
self.options.parse!(ARGV)
|
||||
initialize_project_from_yaml(self.project_name)
|
||||
end
|
||||
|
||||
# generates output CSS based on any args passed in
|
||||
# overwrites any existing CSS, as well as grid.png and tests
|
||||
def generate!
|
||||
output_header # information to the user (in the console) describing custom settings
|
||||
generate_css_files # loops through Blueprint::CSS_FILES to generate output CSS
|
||||
generate_tests # updates HTML with custom namespaces in order to test the generated library. TODO: have tests kick out to custom location
|
||||
output_footer # informs the user that the CSS generation process is complete
|
||||
end
|
||||
|
||||
def options #:nodoc:#
|
||||
OptionParser.new do |o|
|
||||
o.set_summary_indent(' ')
|
||||
o.banner = "Usage: #{@script_name} [options]"
|
||||
o.define_head "Blueprint Compressor"
|
||||
o.separator ""
|
||||
o.separator "options"
|
||||
o.on( "-oOUTPUT_PATH", "--output_path=OUTPUT_PATH", String,
|
||||
"Define a different path to output generated CSS files to.") { |path| self.destination_path = path }
|
||||
o.on( "-nBP_NAMESPACE", "--namespace=BP_NAMESPACE", String,
|
||||
"Define a namespace prepended to all Blueprint classes (e.g. .your-ns-span-24)") { |ns| self.namespace = ns }
|
||||
o.on( "-pPROJECT_NAME", "--project=PROJECT_NAME", String,
|
||||
"If using the settings.yml file, PROJECT_NAME is the project name you want to export") {|project| @project_name = project }
|
||||
o.on( "--column_width=COLUMN_WIDTH", Integer,
|
||||
"Set a new column width (in pixels) for the output grid") {|cw| self.custom_layout.column_width = cw }
|
||||
o.on( "--gutter_width=GUTTER_WIDTH", Integer,
|
||||
"Set a new gutter width (in pixels) for the output grid") {|gw| self.custom_layout.gutter_width = gw }
|
||||
o.on( "--column_count=COLUMN_COUNT", Integer,
|
||||
"Set a new column count for the output grid") {|cc| self.custom_layout.column_count = cc }
|
||||
#o.on("-v", "--verbose", "Turn on verbose output.") { |$verbose| }
|
||||
o.on("-h", "--help", "Show this help message.") { puts o; exit }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# attempts to load output settings from settings.yml
|
||||
def initialize_project_from_yaml(project_name = nil)
|
||||
# ensures project_name is set and settings.yml is present
|
||||
return unless (project_name && File.exist?(Blueprint::SETTINGS_FILE))
|
||||
|
||||
# loads yaml into hash
|
||||
projects = YAML::load(File.path_to_string(Blueprint::SETTINGS_FILE))
|
||||
|
||||
if (project = projects[project_name]) # checks to see if project info is present
|
||||
self.namespace = project['namespace'] || ""
|
||||
self.destination_path = (self.destination_path == Blueprint::BLUEPRINT_ROOT_PATH ? project['path'] : self.destination_path) || Blueprint::BLUEPRINT_ROOT_PATH
|
||||
self.custom_css = project['custom_css'] || {}
|
||||
self.semantic_classes = project['semantic_classes'] || {}
|
||||
self.plugins = project['plugins'] || []
|
||||
|
||||
if (layout = project['custom_layout'])
|
||||
self.custom_layout = CustomLayout.new(:column_count => layout['column_count'], :column_width => layout['column_width'], :gutter_width => layout['gutter_width'], :input_padding => layout['input_padding'], :input_border => layout['input_border'])
|
||||
end
|
||||
@loaded_from_settings = true
|
||||
end
|
||||
end
|
||||
|
||||
def generate_css_files
|
||||
Blueprint::CSS_FILES.each do |output_file_name, css_source_file_names|
|
||||
css_output_path = File.join(destination_path, output_file_name)
|
||||
puts "\n Assembling to #{custom_path ? css_output_path : "default blueprint path"}"
|
||||
|
||||
# CSS file generation
|
||||
css_output = css_file_header # header included on all three Blueprint-generated files
|
||||
css_output += "\n\n"
|
||||
|
||||
# Iterate through src/ .css files and compile to individual core compressed file
|
||||
css_source_file_names.each do |css_source_file|
|
||||
puts " + src/#{css_source_file}"
|
||||
css_output += "/* #{css_source_file} */\n" if css_source_file_names.any?
|
||||
|
||||
source_options = if self.custom_layout && css_source_file == 'grid.css'
|
||||
self.custom_layout.generate_grid_css
|
||||
else
|
||||
File.path_to_string File.join(Blueprint::SOURCE_PATH, css_source_file)
|
||||
end
|
||||
|
||||
css_output += Blueprint::CSSParser.new(source_options, :namespace => namespace).to_s
|
||||
css_output += "\n"
|
||||
end
|
||||
|
||||
# append CSS from custom files
|
||||
css_output = append_custom_css(css_output, output_file_name)
|
||||
|
||||
#append CSS from plugins
|
||||
css_output = append_plugin_css(css_output, output_file_name)
|
||||
|
||||
#save CSS to correct path, stripping out any extra whitespace at the end of the file
|
||||
File.string_to_file(css_output.rstrip, css_output_path)
|
||||
end
|
||||
|
||||
# append semantic class names if set
|
||||
append_semantic_classes
|
||||
|
||||
#attempt to generate a grid.png file
|
||||
if (grid_builder = GridBuilder.new(:column_width => self.custom_layout.column_width, :gutter_width => self.custom_layout.gutter_width, :output_path => File.join(self.destination_path, 'src')))
|
||||
grid_builder.generate!
|
||||
end
|
||||
end
|
||||
|
||||
def append_custom_css(css, current_file_name)
|
||||
# check to see if a custom (non-default) location was used for output files
|
||||
# if custom path is used, handle custom CSS, if any
|
||||
return css unless self.custom_path and self.custom_css[current_file_name]
|
||||
|
||||
self.custom_css[current_file_name].each do |custom_css|
|
||||
overwrite_path = File.join(destination_path, (custom_css || "my-#{current_file_name}"))
|
||||
overwrite_css = File.exists?(overwrite_path) ? File.path_to_string(overwrite_path) : ""
|
||||
|
||||
# if there's CSS present, add it to the CSS output
|
||||
unless overwrite_css.blank?
|
||||
puts " + custom styles (#{custom_css})\n"
|
||||
css += "/* #{overwrite_path} */\n"
|
||||
css += CSSParser.new(overwrite_css).to_s + "\n"
|
||||
end
|
||||
end
|
||||
|
||||
css
|
||||
end
|
||||
|
||||
def append_plugin_css(css, current_file_name)
|
||||
return css unless self.plugins.any?
|
||||
|
||||
plugin_css = ""
|
||||
|
||||
self.plugins.each do |plugin|
|
||||
plugin_file_specific = File.join(Blueprint::PLUGINS_PATH, plugin, current_file_name)
|
||||
plugin_file_generic = File.join(Blueprint::PLUGINS_PATH, plugin, "#{plugin}.css")
|
||||
|
||||
file = if File.exists?(plugin_file_specific)
|
||||
plugin_file_specific
|
||||
elsif File.exists?(plugin_file_generic) && current_file_name =~ /^screen|print/
|
||||
plugin_file_generic
|
||||
end
|
||||
|
||||
if file
|
||||
puts " + #{plugin} plugin\n"
|
||||
plugin_css += "/* #{plugin} */\n"
|
||||
plugin_css += CSSParser.new(File.path_to_string(file)).to_s + "\n"
|
||||
|
||||
Dir.glob(File.join(File.dirname(file), "**", "**")).each do |cp|
|
||||
short_path = cp.gsub(/#{File.dirname(file)}./ , '')
|
||||
# make directory if it doesn't exist
|
||||
directory = File.dirname(short_path)
|
||||
FileUtils.mkdir_p(File.join(destination_path, directory)) unless directory == "."
|
||||
FileUtils.cp cp, File.join(destination_path, short_path) unless File.directory?(File.join(File.dirname(file), short_path)) || cp == file
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
css += plugin_css
|
||||
end
|
||||
|
||||
def append_semantic_classes
|
||||
screen_output_path = File.join(self.destination_path, "screen.css")
|
||||
semantic_styles = SemanticClassNames.new(:namespace => self.namespace, :source_file => screen_output_path).css_from_assignments(self.semantic_classes)
|
||||
return if semantic_styles.blank?
|
||||
|
||||
css = File.path_to_string(screen_output_path)
|
||||
css += "\n\n/* semantic class names */\n"
|
||||
css += semantic_styles
|
||||
File.string_to_file(css.rstrip, screen_output_path)
|
||||
end
|
||||
|
||||
def generate_tests
|
||||
puts "\n Updating namespace to \"#{namespace}\" in test files:"
|
||||
test_files = Compressor::TEST_FILES.map {|f| File.join(Blueprint::TEST_PATH, *f.split(/\//))}
|
||||
|
||||
test_files.each do |file|
|
||||
puts " + #{file}"
|
||||
Namespace.new(file, namespace)
|
||||
end
|
||||
end
|
||||
|
||||
def output_header
|
||||
puts "\n"
|
||||
puts " #{"*" * 100}"
|
||||
puts " **"
|
||||
puts " ** Blueprint CSS Compressor"
|
||||
puts " **"
|
||||
puts " ** Builds compressed files from the source directory."
|
||||
puts " **"
|
||||
puts " ** Loaded from settings.yml" if loaded_from_settings
|
||||
puts " ** Namespace: '#{namespace}'" unless namespace.blank?
|
||||
puts " ** Output to: #{destination_path}"
|
||||
puts " ** Grid Settings:"
|
||||
puts " ** - Column Count: #{self.custom_layout.column_count}"
|
||||
puts " ** - Column Width: #{self.custom_layout.column_width}px"
|
||||
puts " ** - Gutter Width: #{self.custom_layout.gutter_width}px"
|
||||
puts " ** - Total Width : #{self.custom_layout.page_width}px"
|
||||
puts " **"
|
||||
puts " #{"*" * 100}"
|
||||
end
|
||||
|
||||
def output_footer
|
||||
puts "\n\n"
|
||||
puts " #{"*" * 100}"
|
||||
puts " **"
|
||||
puts " ** Done!"
|
||||
puts " ** Your compressed files and test files are now up-to-date."
|
||||
puts " **"
|
||||
puts " #{"*" * 100}\n\n"
|
||||
end
|
||||
|
||||
def css_file_header
|
||||
%(/* -----------------------------------------------------------------------
|
||||
|
||||
|
||||
Blueprint CSS Framework 0.8
|
||||
http://blueprintcss.org
|
||||
|
||||
* Copyright (c) 2007-Present. See LICENSE for more info.
|
||||
* See README for instructions on how to use Blueprint.
|
||||
* For credits and origins, see AUTHORS.
|
||||
* This is a compressed file. See the sources in the 'src' directory.
|
||||
|
||||
----------------------------------------------------------------------- */)
|
||||
end
|
||||
|
||||
def putsv(str)
|
||||
puts str if $verbose
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,39 @@
|
|||
class String
|
||||
# see if string has any content
|
||||
def blank?; self.length.zero?; end
|
||||
|
||||
# strip space after :, remove newlines, replace multiple spaces with only one space, remove comments
|
||||
def strip_space!
|
||||
replace self.gsub(/:\s*/, ':').gsub(/\n/, '').gsub(/\s+/, ' ').gsub(/(\/\*).*?(\*\/)/, '')
|
||||
end
|
||||
|
||||
# remove newlines, insert space after comma, replace two spaces with one space after comma
|
||||
def strip_selector_space!
|
||||
replace self.gsub(/(\n)/, '').gsub(',', ', ').gsub(', ', ', ')
|
||||
end
|
||||
|
||||
# remove leading whitespace, remove end whitespace
|
||||
def strip_side_space!
|
||||
replace self.gsub(/^\s+/, '').gsub(/\s+$/, $/)
|
||||
end
|
||||
end
|
||||
|
||||
class NilClass
|
||||
def blank?
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class File
|
||||
# string output from file
|
||||
def self.path_to_string(path)
|
||||
File.new(path).read
|
||||
end
|
||||
|
||||
# saves a string to a specified file path
|
||||
def self.string_to_file(string, path)
|
||||
directory = File.dirname(path)
|
||||
FileUtils.mkdir_p directory unless File.directory?(directory)
|
||||
File.open(path, 'w') { |f| f << string }
|
||||
end
|
||||
end
|
|
@ -0,0 +1,69 @@
|
|||
module Blueprint
|
||||
# Strips out most whitespace and can return a hash or string of parsed data
|
||||
class CSSParser
|
||||
attr_accessor :namespace
|
||||
attr_reader :css_output, :raw_data
|
||||
|
||||
# ==== Options
|
||||
# * <tt>css_string</tt> String of CSS data
|
||||
# * <tt>options</tt>
|
||||
# * <tt>:namespace</tt> -- Namespace to use when generating output
|
||||
def initialize(css_string = "", options = {})
|
||||
@raw_data = css_string
|
||||
@namespace = options[:namespace] || ""
|
||||
compress(@raw_data)
|
||||
end
|
||||
|
||||
# returns string of CSS which can be saved to a file or otherwise
|
||||
def to_s
|
||||
@css_output
|
||||
end
|
||||
|
||||
# returns a hash of all CSS data passed
|
||||
#
|
||||
# ==== Options
|
||||
# * <tt>data</tt> -- CSS string; defaults to string passed into the constructor
|
||||
def parse(data = nil)
|
||||
data ||= @raw_data
|
||||
|
||||
# wrapper array holding hashes of css tags/rules
|
||||
css_out = []
|
||||
# clear initial spaces
|
||||
data.strip_side_space!.strip_space!
|
||||
|
||||
# split on end of assignments
|
||||
data.split('}').each_with_index do |assignments, index|
|
||||
# split again to separate tags from rules
|
||||
tags, styles = assignments.split('{').map{|a| a.strip_side_space!}
|
||||
unless styles.blank?
|
||||
# clean up tags and apply namespaces as needed
|
||||
tags.strip_selector_space!
|
||||
tags.gsub!(/\./, ".#{namespace}") unless namespace.blank?
|
||||
|
||||
# split on semicolon to iterate through each rule
|
||||
rules = []
|
||||
styles.split(';').each do |key_val_pair|
|
||||
unless key_val_pair.nil?
|
||||
# split by property/val and append to rules array with correct declaration
|
||||
property, value = key_val_pair.split(':').map{|kv| kv.strip_side_space!}
|
||||
break unless property && value
|
||||
rules << "#{property}:#{value};"
|
||||
end
|
||||
end
|
||||
# now keeps track of index as hashes don't keep track of position (which will be fixed in Ruby 1.9)
|
||||
css_out << {:tags => tags, :rules => rules.to_s, :idx => index} unless tags.blank? || rules.to_s.blank?
|
||||
end
|
||||
end
|
||||
css_out
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compress(data)
|
||||
@css_output = ""
|
||||
parse(data).flatten.sort_by {|i| i[:idx]}.each do |line|
|
||||
@css_output += "#{line[:tags]} {#{line[:rules]}}\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,71 @@
|
|||
require 'erb'
|
||||
module Blueprint
|
||||
# Generates a custom grid file, using ERB to evaluate custom settings
|
||||
class CustomLayout
|
||||
# path to ERB file used for CSS template
|
||||
CSS_ERB_FILE = File.join(Blueprint::LIB_PATH, 'grid.css.erb')
|
||||
|
||||
attr_writer :column_count, :column_width, :gutter_width, :input_padding, :input_border
|
||||
|
||||
# Column count of generated CSS. Returns itself or Blueprint's default
|
||||
def column_count
|
||||
(@column_count || Blueprint::COLUMN_COUNT).to_i
|
||||
end
|
||||
|
||||
# Column width (in pixels) of generated CSS. Returns itself or Blueprint's default
|
||||
def column_width
|
||||
(@column_width || Blueprint::COLUMN_WIDTH).to_i
|
||||
end
|
||||
|
||||
# Gutter width (in pixels) of generated CSS. Returns itself or Blueprint's default
|
||||
def gutter_width
|
||||
(@gutter_width || Blueprint::GUTTER_WIDTH).to_i
|
||||
end
|
||||
|
||||
def input_padding
|
||||
(@input_padding || Blueprint::INPUT_PADDING).to_i
|
||||
end
|
||||
|
||||
def input_border
|
||||
(@input_border || Blueprint::INPUT_BORDER).to_i
|
||||
end
|
||||
|
||||
# Returns page width (in pixels)
|
||||
def page_width
|
||||
column_count * (column_width + gutter_width) - gutter_width
|
||||
end
|
||||
|
||||
# ==== Options
|
||||
# * <tt>options</tt>
|
||||
# * <tt>:column_count</tt> -- Sets the column count of generated CSS
|
||||
# * <tt>:column_width</tt> -- Sets the column width (in pixels) of generated CSS
|
||||
# * <tt>:gutter_width</tt> -- Sets the gutter width (in pixels) of generated CSS
|
||||
# * <tt>:input_padding</tt> -- Sets the input padding width (in pixels) of generated CSS
|
||||
# * <tt>:input_border</tt> -- Sets the border width (in pixels) of generated CSS
|
||||
def initialize(options = {})
|
||||
@column_count = options[:column_count]
|
||||
@column_width = options[:column_width]
|
||||
@gutter_width = options[:gutter_width]
|
||||
@input_padding = options[:input_padding]
|
||||
@input_border = options[:input_border]
|
||||
end
|
||||
|
||||
# Boolean value if current settings are Blueprint's defaults
|
||||
def default?
|
||||
self.column_width == Blueprint::COLUMN_WIDTH &&
|
||||
self.column_count == Blueprint::COLUMN_COUNT &&
|
||||
self.gutter_width == Blueprint::GUTTER_WIDTH &&
|
||||
self.input_padding == Blueprint::INPUT_PADDING &&
|
||||
self.input_border == Blueprint::INPUT_BORDER
|
||||
end
|
||||
|
||||
# Loads grid.css.erb file, binds it to current instance, and returns output
|
||||
def generate_grid_css
|
||||
# loads up erb template to evaluate custom widths
|
||||
css = ERB::new(File.path_to_string(CustomLayout::CSS_ERB_FILE))
|
||||
|
||||
# bind it to this instance
|
||||
css.result(binding)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,136 @@
|
|||
/* --------------------------------------------------------------
|
||||
grid.css - mirror version of src/grid.css
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
/* A container should group all your columns. */
|
||||
.container {
|
||||
width: <%= page_width %>px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/* Use this class on any div.span / container to see the grid. */
|
||||
.showgrid {
|
||||
background: url(src/grid.png);
|
||||
}
|
||||
|
||||
|
||||
/* Columns
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
/* Sets up basic grid floating and margin. */
|
||||
.column, <%= (1..column_count).map {|c| "div.span-#{c}" }.join(", ") %> {
|
||||
float: left;
|
||||
margin-right: <%= gutter_width %>px;
|
||||
}
|
||||
|
||||
/* The last column in a row needs this class. */
|
||||
.last, div.last { margin-right: 0; }
|
||||
|
||||
/* Use these classes to set the width of a column. */
|
||||
.span-1 {width: <%= column_width %>px;}
|
||||
<% (2..column_count-1).each do |column| %>
|
||||
.span-<%= column %> {width: <%= (column_width + ((column - 1) * (column_width + gutter_width))).to_i %>px;<%= "margin: 0;" if column == column_count %>}<% end %>
|
||||
.span-<%= column_count %>, div.span-<%= column_count %> { width:<%= page_width %>px; margin:0; }
|
||||
|
||||
/* Use these classes to set the width of an input. */
|
||||
<%= (1..column_count).map {|column| "input.span-#{column}, textarea.span-#{column}"}.join(", ") %> {
|
||||
border-left-width: <%= input_border %>px!important;
|
||||
border-right-width: <%= input_border %>px!important;
|
||||
padding-left: <%= input_padding %>px!important;
|
||||
padding-right: <%= input_padding %>px!important;
|
||||
}
|
||||
<% (1..column_count).each do |column| %>
|
||||
input.span-<%= column %>, textarea.span-<%= column %> { width: <%= ((column_width + gutter_width) * (column - 1) + column_width - 2*(input_padding + input_border))%>px!important; }<% end %>
|
||||
|
||||
/* Add these to a column to append empty cols. */
|
||||
<% (1..(column_count-1)).each do |column| %>
|
||||
.append-<%= column %> { padding-right: <%= (column * (column_width + gutter_width)).to_i %>px;}<% end %>
|
||||
|
||||
/* Add these to a column to prepend empty cols. */
|
||||
<% (1..(column_count-1)).each do |column| %>
|
||||
.prepend-<%= column %> { padding-left: <%= (column * (column_width + gutter_width)).to_i %>px;}<% end %>
|
||||
|
||||
|
||||
/* Border on right hand side of a column. */
|
||||
div.border {
|
||||
padding-right: <%= (gutter_width * 0.5 - 1).to_i %>px;
|
||||
margin-right: <%= (gutter_width * 0.5).to_i %>px;
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* Border with more whitespace, spans one column. */
|
||||
div.colborder {
|
||||
padding-right: <%= (column_width + 2*gutter_width - 1)/2.to_i %>px;
|
||||
margin-right: <%= (column_width + 2 * gutter_width)/2.to_i %>px;
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
|
||||
|
||||
/* Use these classes on an element to push it into the
|
||||
next column, or to pull it into the previous column. */
|
||||
|
||||
<% (1..column_count).each do |column| %>
|
||||
.pull-<%= column %> { margin-left: -<%= (column * (column_width + gutter_width)).to_i %>px; }<% end %>
|
||||
|
||||
<%= (1..column_count).map {|c| ".pull-#{c}" }.join(", ") %> {float: left; position:relative;}
|
||||
|
||||
<% (1..(column_count)).each do |column| %>
|
||||
.push-<%= column %> { margin: 0 -<%= (column * (column_width + gutter_width)).to_i %>px 1.5em <%= (column * (column_width + gutter_width)).to_i %>px; }<% end %>
|
||||
|
||||
<%= (1..column_count).map {|c| ".push-#{c}" }.join(", ") %> {float: right; position:relative;}
|
||||
|
||||
|
||||
/* Misc classes and elements
|
||||
-------------------------------------------------------------- */
|
||||
|
||||
/* In case you need to add a gutter above/below an element */
|
||||
.prepend-top {
|
||||
margin-top:1.5em;
|
||||
}
|
||||
.append-bottom {
|
||||
margin-bottom:1.5em;
|
||||
}
|
||||
|
||||
/* Use a .box to create a padded box inside a column. */
|
||||
.box {
|
||||
padding: 1.5em;
|
||||
margin-bottom: 1.5em;
|
||||
background: #E5ECF9;
|
||||
}
|
||||
|
||||
/* Use this to create a horizontal ruler across a column. */
|
||||
hr {
|
||||
background: #ddd;
|
||||
color: #ddd;
|
||||
clear: both;
|
||||
float: none;
|
||||
width: 100%;
|
||||
height: .1em;
|
||||
margin: 0 0 1.45em;
|
||||
border: none;
|
||||
}
|
||||
|
||||
hr.space {
|
||||
background: #fff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
/* Clearing floats without extra markup
|
||||
Based on How To Clear Floats Without Structural Markup by PiE
|
||||
[http://www.positioniseverything.net/easyclearing.html] */
|
||||
|
||||
.clearfix:after, .container:after {
|
||||
content: "\0020";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
overflow:hidden;
|
||||
}
|
||||
.clearfix, .container {display: block;}
|
||||
|
||||
/* Regular clearing
|
||||
apply to column that should drop below previous ones. */
|
||||
|
||||
.clear { clear:both; }
|
|
@ -0,0 +1,54 @@
|
|||
begin
|
||||
require 'rubygems'
|
||||
gem 'rmagick'
|
||||
require 'rvg/rvg'
|
||||
rescue Exception => e
|
||||
end
|
||||
|
||||
module Blueprint
|
||||
# Uses ImageMagick and RMagick to generate grid.png file
|
||||
class GridBuilder
|
||||
begin
|
||||
include Magick
|
||||
rescue Exception => e
|
||||
end
|
||||
|
||||
attr_reader :column_width, :gutter_width, :output_path, :able_to_generate
|
||||
|
||||
# ==== Options
|
||||
# * <tt>options</tt>
|
||||
# * <tt>:column_width</tt> -- Width (in pixels) of current grid column
|
||||
# * <tt>:gutter_width</tt> -- Width (in pixels) of current grid gutter
|
||||
# * <tt>:output_path</tt> -- Output path of grid.png file
|
||||
def initialize(options={})
|
||||
@able_to_generate = Magick::Long_version rescue false
|
||||
return unless @able_to_generate
|
||||
@column_width = options[:column_width] || Blueprint::COLUMN_WIDTH
|
||||
@gutter_width = options[:gutter_width] || Blueprint::GUTTER_WIDTH
|
||||
@output_path = options[:output_path] || Blueprint::SOURCE_PATH
|
||||
end
|
||||
|
||||
# generates (overwriting if necessary) grid.png image to be tiled in background
|
||||
def generate!
|
||||
return false unless self.able_to_generate
|
||||
total_width = self.column_width + self.gutter_width
|
||||
height = 18
|
||||
RVG::dpi = 100
|
||||
|
||||
rvg = RVG.new((total_width.to_f/RVG::dpi).in, (height.to_f/RVG::dpi).in).viewbox(0, 0, total_width, height) do |canvas|
|
||||
canvas.background_fill = 'white'
|
||||
|
||||
canvas.g do |column|
|
||||
column.rect(self.column_width, height).styles(:fill => "#e8effb")
|
||||
end
|
||||
|
||||
canvas.g do |baseline|
|
||||
baseline.line(0, (height - 1), total_width, (height- 1)).styles(:fill => "#e9e9e9")
|
||||
end
|
||||
end
|
||||
|
||||
FileUtils.mkdir self.output_path unless File.exists? self.output_path
|
||||
rvg.draw.write(File.join(self.output_path, "grid.png"))
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,38 @@
|
|||
module Blueprint
|
||||
class Namespace
|
||||
|
||||
# Read html to string, remove namespace if any,
|
||||
# set the new namespace, and update the test file.
|
||||
def initialize(path, namespace)
|
||||
html = File.path_to_string(path)
|
||||
remove_current_namespace(html)
|
||||
add_namespace(html, namespace)
|
||||
File.string_to_file(html, path)
|
||||
end
|
||||
|
||||
# adds namespace to BP classes in a html file
|
||||
def add_namespace(html, namespace)
|
||||
html.gsub!(/(class=")([a-zA-Z0-9\-_ ]*)(")/) do |m|
|
||||
classes = m.to_s.split('"')[1].split(' ')
|
||||
classes.map! { |c| c = namespace + c }
|
||||
'class="' + classes.join(' ') + '"'
|
||||
end
|
||||
html
|
||||
end
|
||||
|
||||
# removes a namespace from a string of html
|
||||
def remove_current_namespace(html)
|
||||
current = current_namespace(html)
|
||||
html.gsub!(current, '')
|
||||
html
|
||||
end
|
||||
|
||||
# returns current namespace in test files
|
||||
# based on container class
|
||||
def current_namespace(html)
|
||||
html =~ /class="([\S]+)container/
|
||||
current_namespace = $1 if $1
|
||||
current_namespace || ''
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,57 @@
|
|||
module Blueprint
|
||||
# parses a hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from
|
||||
class SemanticClassNames
|
||||
attr_accessor :class_assignments
|
||||
attr_reader :namespace, :source_file
|
||||
|
||||
# ==== Options
|
||||
# * <tt>options</tt>
|
||||
# * <tt>:namespace</tt> -- Namespace to be used when matching CSS selectors to draw from
|
||||
# * <tt>:source_file</tt> -- Source file to use as reference of CSS selectors. Defaults to Blueprint's generated screen.css
|
||||
# * <tt>:class_assignments</tt> -- Hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from
|
||||
def initialize(options = {})
|
||||
@namespace = options[:namespace] || ""
|
||||
@source_file = options[:source_file] || File.join(Blueprint::BLUEPRINT_ROOT_PATH, 'screen.css')
|
||||
self.class_assignments = options[:class_assignments] || {}
|
||||
end
|
||||
|
||||
# Returns a CSS string of semantic selectors and associated styles
|
||||
# ==== Options
|
||||
# * <tt>assignments</tt> -- Hash of key/value pairs, key being output CSS selectors, value being a list of CSS selectors to draw from; defaults to what was passed in constructor or empty hash
|
||||
def css_from_assignments(assignments = {})
|
||||
assignments ||= self.class_assignments
|
||||
|
||||
# define a wrapper hash to hold all the new CSS assignments
|
||||
output_css = {}
|
||||
|
||||
#loads full stylesheet into an array of hashes
|
||||
blueprint_assignments = CSSParser.new(File.path_to_string(self.source_file)).parse
|
||||
|
||||
# iterates through each class assignment ('#footer' => '.span-24 div.span-24', '#header' => '.span-24 div.span-24')
|
||||
assignments.each do |semantic_class, blueprint_classes|
|
||||
# gathers all BP classes we're going to be mimicing
|
||||
blueprint_classes = blueprint_classes.split(/,|\s/).find_all {|c| !c.blank? }.flatten.map {|c| c.strip }
|
||||
classes = []
|
||||
# loop through each BP class, grabbing the full hash (containing tags, index, and CSS rules)
|
||||
blueprint_classes.each do |bp_class|
|
||||
match = bp_class.include?('.') ? bp_class.gsub(".", ".#{self.namespace}") : ".#{self.namespace}#{bp_class}"
|
||||
classes << blueprint_assignments.find_all {|line| line[:tags] =~ Regexp.new(/^([\w\.\-\:]+, ?)*#{match}(, ?[\w\.\-\:]+)*$/) }.uniq
|
||||
end
|
||||
|
||||
# clean up the array
|
||||
classes = classes.flatten.uniq
|
||||
|
||||
# set the semantic class to the rules gathered in classes, sorted by index
|
||||
# this way, the styles will be applied in the correct order from top of file to bottom
|
||||
output_css[semantic_class] = "#{classes.sort_by {|i| i[:idx]}.map {|i| i[:rules]}}"
|
||||
end
|
||||
|
||||
# return the css in proper format
|
||||
css = ""
|
||||
output_css.each do |tags, rules|
|
||||
css += "#{tags} {#{rules}}\n"
|
||||
end
|
||||
css
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang='en' lang='en'>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
||||
<link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/base.css" />
|
||||
<title>W3C IPR SOFTWARE NOTICE</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>W3C<sup>®</sup> SOFTWARE NOTICE AND LICENSE</h1>
|
||||
|
||||
<h3>Copyright © 1997-2002 <a href="http://www.w3.org/">World
|
||||
Wide Web Consortium</a>, (<a
|
||||
href="http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a
|
||||
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
|
||||
Reserved. http://www.w3.org/Consortium/Legal/</h3>
|
||||
|
||||
<p>This W3C work (including software, documents, or other related
|
||||
items) is being provided by the copyright holders under the
|
||||
following license. By obtaining, using and/or copying this work,
|
||||
you (the licensee) agree that you have read, understood, and will
|
||||
comply with the following terms and conditions:</p>
|
||||
|
||||
<p>Permission to use, copy, modify, and distribute this software
|
||||
and its documentation, with or without modification, for any
|
||||
purpose and without fee or royalty is hereby granted, provided that
|
||||
you include the following on ALL copies of the software and
|
||||
documentation or portions thereof, including modifications, that
|
||||
you make:</p>
|
||||
|
||||
<ol>
|
||||
<li>The full text of this NOTICE in a location viewable to users of
|
||||
the redistributed or derivative work.</li>
|
||||
|
||||
<li>Any pre-existing intellectual property disclaimers, notices, or
|
||||
terms and conditions. If none exist, a short notice of the
|
||||
following form (hypertext is preferred, text is permitted) should
|
||||
be used within the body of any redistributed or derivative code:
|
||||
"Copyright © [$date-of-software] <a
|
||||
href="http://www.w3.org/">World Wide Web Consortium</a>, (<a
|
||||
href="http://www.lcs.mit.edu/">Massachusetts Institute of
|
||||
Technology</a>, <a href="http://www.inria.fr/">Institut National de
|
||||
Recherche en Informatique et en Automatique</a>, <a
|
||||
href="http://www.keio.ac.jp/">Keio University</a>). All Rights
|
||||
Reserved. http://www.w3.org/Consortium/Legal/"</li>
|
||||
|
||||
<li>Notice of any changes or modifications to the W3C files,
|
||||
including the date changes were made. (We recommend you provide
|
||||
URIs to the location from which the code is derived.)</li>
|
||||
</ol>
|
||||
|
||||
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND
|
||||
COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
|
||||
USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
|
||||
PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
|
||||
|
||||
<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
|
||||
SOFTWARE OR DOCUMENTATION.</p>
|
||||
|
||||
<p>The name and trademarks of copyright holders may NOT be used in
|
||||
advertising or publicity pertaining to the software without
|
||||
specific, written prior permission. Title to copyright in this
|
||||
software and any associated documentation will at all times remain
|
||||
with copyright holders.</p>
|
||||
|
||||
<p>____________________________________</p>
|
||||
|
||||
<p>This formulation of W3C's notice and license became active on
|
||||
August 14 1998 so as to improve compatibility with GPL. This
|
||||
version ensures that W3C software licensing terms are no more
|
||||
restrictive than GPL and consequently W3C software may be
|
||||
distributed in GPL packages. See the <a
|
||||
href="copyright-software-19980519.html">older formulation</a> for
|
||||
the policy prior to this date. Please see our <a
|
||||
href="IPR-FAQ.html">Copyright FAQ</a> for common questions about
|
||||
using materials from our site, including specific terms and
|
||||
conditions for packages like libwww, Amaya, and Jigsaw. Other
|
||||
questions about this notice can be directed to <a
|
||||
href="mailto:site-policy@w3.org">site-policy@w3.org</a>.<br />
|
||||
</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<address><a href="http://www.w3.org/Help/Webmaster.html">webmaster</a><br />
|
||||
(last updated $Date: 2004/05/29 04:04:36 $)</address>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,64 @@
|
|||
W3C IPR SOFTWARE NOTICE
|
||||
|
||||
Copyright © 1995-1998 World Wide Web Consortium, (Massachusetts Institute of
|
||||
Technology, Institut National de Recherche en Informatique et en
|
||||
Automatique, Keio University). All Rights Reserved.
|
||||
http://www.w3.org/Consortium/Legal/
|
||||
|
||||
This W3C work (including software, documents, or other related items) is
|
||||
being provided by the copyright holders under the following license. By
|
||||
obtaining, using and/or copying this work, you (the licensee) agree that you
|
||||
have read, understood, and will comply with the following terms and
|
||||
conditions:
|
||||
|
||||
Permission to use, copy, and modify this software and its documentation,
|
||||
with or without modification, for any purpose and without fee or royalty is
|
||||
hereby granted, provided that you include the following on ALL copies of the
|
||||
software and documentation or portions thereof, including modifications,
|
||||
that you make:
|
||||
|
||||
1. The full text of this NOTICE in a location viewable to users of the
|
||||
redistributed or derivative work.
|
||||
2. Any pre-existing intellectual property disclaimers, notices, or terms
|
||||
and conditions. If none exist, a short notice of the following form
|
||||
(hypertext is preferred, text is permitted) should be used within the
|
||||
body of any redistributed or derivative code: "Copyright © World Wide
|
||||
Web Consortium, (Massachusetts Institute of Technology, Institut
|
||||
National de Recherche en Informatique et en Automatique, Keio
|
||||
University). All Rights Reserved. http://www.w3.org/Consortium/Legal/"
|
||||
3. Notice of any changes or modifications to the W3C files, including the
|
||||
date changes were made. (We recommend you provide URIs to the location
|
||||
from which the code is derived).
|
||||
|
||||
In addition, creators of derivitive works must include the full text of this
|
||||
NOTICE in a location viewable to users of the derivitive work.
|
||||
|
||||
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS
|
||||
MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR
|
||||
PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
|
||||
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
|
||||
|
||||
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
|
||||
DOCUMENTATION.
|
||||
|
||||
The name and trademarks of copyright holders may NOT be used in advertising
|
||||
or publicity pertaining to the software without specific, written prior
|
||||
permission. Title to copyright in this software and any associated
|
||||
documentation will at all times remain with copyright holders.
|
||||
|
||||
____________________________________
|
||||
|
||||
This formulation of W3C's notice and license became active on August 14
|
||||
1998. See the older formulation for the policy prior to this date. Please
|
||||
see our Copyright FAQ for common questions about using materials from our
|
||||
site, including specific terms and conditions for packages like libwww,
|
||||
Amaya, and Jigsaw. Other questions about this notice can be directed to
|
||||
site-policy@w3.org .
|
||||
|
||||
|
||||
|
||||
|
||||
webmaster
|
||||
(last updated 14-Aug-1998)
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CSS Validator Binary Distribution - Illumit</title>
|
||||
<link title="RSS Feed" type="application/rss+xml" rel="alternate" href="http://www.illumit.com/site.rss" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>CSS Validator Binary Distribution</h1>
|
||||
<p>This a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a>.
|
||||
It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
|
||||
No modifications were made.</p>
|
||||
|
||||
<p>This distribution is provided <a href="#asis">as is</a> to make testing a large number of CSS files easier.</p>
|
||||
|
||||
|
||||
<h2>Requirements</h2>
|
||||
<p>A Java 2 Virtual Machine is required to use the validator.
|
||||
You can download one from <a href="http://java.sun.com/">Sun</a> if you do not have one installed.</p>
|
||||
|
||||
<h2>Usage</h2>
|
||||
<h2>Summary</h2>
|
||||
<p><code>java -jar <samp>~/css-validator/</samp>css-validator.jar [-options] files URLs</code></p>
|
||||
<h2>Sample</h2>
|
||||
<pre>
|
||||
java -jar ~/css-validator/css-validator.jar f1.css http://illumit.com/
|
||||
</pre>
|
||||
<h2>Options</h2>
|
||||
<dl>
|
||||
<dt>-e</dt><dd>Show errors only.</dd>
|
||||
<dt>-html</dt><dd>Output HTML.</dd>
|
||||
<dt>-css1 | -css2 | -css21 | -css3 | -svg | -svgbasic | -svgtiny</dt>
|
||||
<dd>Specify CSS version. CSS2 is the default.</dd>
|
||||
</dl>
|
||||
|
||||
<h2>Support</h2>
|
||||
|
||||
<p>If you have questions about how this distribution is built or packaged,
|
||||
<a href="mailto:contact@illumit.com">mailto:contact@illumit.com</a>.</p>
|
||||
|
||||
<p>Use the CSS Validator <a href="http://jigsaw.w3.org/css-validator/Email">Feedback</a>
|
||||
page if you have any questions or problems with the validator itself.</p>
|
||||
|
||||
<p class="Footnote">Updates are announced on via
|
||||
<a class="RSSLink" rel="alternate" type="application/rss+xml" href="http://www.illumit.com/site.rss">RSS</a></p>
|
||||
|
||||
<!--
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="css-validator.jar">css-validator.jar</a> Executable JAR package</li>
|
||||
<li><a href="COPYRIGHT.html">COPYRIGHT.html</a> CSS Validator Copyright Notice</li>
|
||||
<li><a href="css-validator-javadoc.jar">css-validator-javadoc.jar</a> CSS Validator API Docs</li>
|
||||
<li>Required libraries:<ul>
|
||||
<li><a href="jigsaw.jar">jigsaw.jar</a> and <a href="JIGSAW_COPYRIGHT">JIGSAW_COPYRIGHT</a></li>
|
||||
<li><a href="xerces.jar">xerces.jar</a> and <a href="XERCES_COPYING.txt">XERCES_COPYING.txt</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
-->
|
||||
|
||||
<h2>Download</h2>
|
||||
|
||||
<p>Download the css validator binary distribution <a href="css-validator.zip">css-validator.zip</a>. Extract the files (OS X and *ix users can use unzip).</p>
|
||||
|
||||
|
||||
<h2><a name="asis">License Agreement</a></h2>
|
||||
|
||||
<p>This is a binary distribution of <a href="http://jigsaw.w3.org/css-validator">W3C CSS Validator</a> Version 2.0
|
||||
It was built from the <a href="http://dev.w3.org/cvsweb/2002/css-validator">source</a> on June 25, 2006.
|
||||
No modifications were made to the source.</p>
|
||||
|
||||
<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND
|
||||
ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS (W3C) MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
|
||||
USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
|
||||
PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p>
|
||||
|
||||
<p>ILLUMIT L.L.C AND THE COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE
|
||||
SOFTWARE OR DOCUMENTATION.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1999 The Apache Software Foundation. All rights
|
||||
* reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution,
|
||||
* if any, must include the following acknowledgment:
|
||||
* "This product includes software developed by the
|
||||
* Apache Software Foundation (http://www.apache.org/)."
|
||||
* Alternately, this acknowledgment may appear in the software itself,
|
||||
* if and wherever such third-party acknowledgments normally appear.
|
||||
*
|
||||
* 4. The names "Xerces" and "Apache Software Foundation" must
|
||||
* not be used to endorse or promote products derived from this
|
||||
* software without prior written permission. For written
|
||||
* permission, please contact apache@apache.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Apache",
|
||||
* nor may "Apache" appear in their name, without prior written
|
||||
* permission of the Apache Software Foundation.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This software consists of voluntary contributions made by many
|
||||
* individuals on behalf of the Apache Software Foundation and was
|
||||
* originally based on software copyright (c) 1999, International
|
||||
* Business Machines, Inc., http://www.ibm.com. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,49 @@
|
|||
module Blueprint
|
||||
# Validates generated CSS against the W3 using Java
|
||||
class Validator
|
||||
attr_reader :error_count
|
||||
|
||||
def initialize
|
||||
@error_count = 0
|
||||
end
|
||||
|
||||
# Validates all three CSS files
|
||||
def validate
|
||||
java_path = `which java`.rstrip
|
||||
raise "You do not have a Java installed, but it is required." if java_path.blank?
|
||||
|
||||
output_header
|
||||
|
||||
Blueprint::CSS_FILES.keys.each do |file_name|
|
||||
css_output_path = File.join(Blueprint::BLUEPRINT_ROOT_PATH, file_name)
|
||||
puts "\n\n Testing #{css_output_path}"
|
||||
puts " Output ============================================================\n\n"
|
||||
@error_count += 1 if !system("#{java_path} -jar '#{Blueprint::VALIDATOR_FILE}' -e '#{css_output_path}'")
|
||||
end
|
||||
|
||||
output_footer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def output_header
|
||||
puts "\n\n"
|
||||
puts " ************************************************************"
|
||||
puts " **"
|
||||
puts " ** Blueprint CSS Validator"
|
||||
puts " ** Validates output CSS files"
|
||||
puts " **"
|
||||
puts " ************************************************************"
|
||||
end
|
||||
|
||||
def output_footer
|
||||
puts "\n\n"
|
||||
puts " ************************************************************"
|
||||
puts " **"
|
||||
puts " ** Done!"
|
||||
puts " ** Your CSS files are#{" not" if error_count > 0} valid.#{" You had #{error_count} error(s) within your files" if error_count > 0}"
|
||||
puts " **"
|
||||
puts " ************************************************************"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,149 @@
|
|||
#!/usr/bin/env ruby
|
||||
require File.join(File.dirname(__FILE__), "blueprint", "blueprint")
|
||||
|
||||
# **Basic
|
||||
#
|
||||
# Calling this file by itself will pull files from blueprint/src and concatenate them into three files; ie.css, print.css, and screen.css.
|
||||
#
|
||||
# ruby compress.rb
|
||||
#
|
||||
# However, argument variables can be set to change how this works.
|
||||
#
|
||||
# Calling
|
||||
#
|
||||
# ruby compress.rb -h
|
||||
#
|
||||
# will reveal basic arguments you can pass to the compress.rb file.
|
||||
#
|
||||
# **Custom Settings
|
||||
#
|
||||
# To use custom settings, the file need to be stored in settings.yml within this directory. An example YAML file has been included.
|
||||
#
|
||||
# Another ability is to use YAML (spec is at http://www.yaml.org/spec/1.1/) for project settings in a predefined structure and
|
||||
# store all pertinent information there. The YAML file has multiple keys (usually a named project) with a set of data that defines
|
||||
# that project. A sample structure can be found in settings.example.yml.
|
||||
#
|
||||
# The basic structure is this:
|
||||
#
|
||||
# Root nodes are project names. You use these when calling compress.rb as such:
|
||||
#
|
||||
# ruby compress.rb -p PROJECTNAME
|
||||
#
|
||||
# A sample YAML with only roots and output paths would look like this:
|
||||
#
|
||||
# project1:
|
||||
# path: /path/to/my/project/stylesheets
|
||||
# project2:
|
||||
# path: /path/to/different/stylesheets
|
||||
# project3:
|
||||
# path: /path/to/another/projects/styles
|
||||
#
|
||||
# You can then call
|
||||
#
|
||||
# ruby compress.rb -p project1
|
||||
#
|
||||
# or
|
||||
#
|
||||
# ruby compress.rb -p project3
|
||||
#
|
||||
# This would compress and export Blueprints CSS to the respective directory, checking for my-(ie|print|screen).css and
|
||||
# appending it if present
|
||||
#
|
||||
# A more advanced structure would look like this:
|
||||
#
|
||||
# project1:
|
||||
# path: /path/to/my/project/stylesheets
|
||||
# namespace: custom-namespace-1-
|
||||
# custom_css:
|
||||
# ie.css:
|
||||
# - custom-ie.css
|
||||
# print.css:
|
||||
# - docs.css
|
||||
# - my-print-styles.css
|
||||
# screen.css:
|
||||
# - subfolder-of-stylesheets/sub_css.css
|
||||
# custom_layout:
|
||||
# column_count: 12
|
||||
# column_width: 70
|
||||
# gutter_width: 10
|
||||
# project2:
|
||||
# path: /path/to/different/stylesheets
|
||||
# namespace: different-namespace-
|
||||
# custom_css:
|
||||
# screen.css:
|
||||
# - custom_screen.css
|
||||
# semantic_classes:
|
||||
# "#footer, #header": column span-24 last
|
||||
# "#content": column span-18 border
|
||||
# "#extra-content": last span-6 column
|
||||
# "div#navigation": last span-24 column
|
||||
# "div.section, div.entry, .feeds": span-6 column
|
||||
# plugins:
|
||||
# - fancy-type
|
||||
# - buttons
|
||||
# - validations
|
||||
# project3:
|
||||
# path: /path/to/another/projects/styles
|
||||
#
|
||||
# In a structure like this, a lot more assignment is occurring. Custom namespaces are being set for two projects, while
|
||||
# the third (project3) is just a simple path setting.
|
||||
#
|
||||
# Also, custom CSS is being used that is appended at the end of its respective file. So, in project1, print.css will have docs.css
|
||||
# and my-print-styles.css instead of the default my-print.css. Note that these files are relative to the path that you defined above;
|
||||
# you can use subdirectories from the default path if you would like.
|
||||
#
|
||||
# Another thing to note here is the custom_layout; if not defined, your generated CSS will default to the 24 column, 950px wide grid that
|
||||
# has been standard with Blueprint for quite some time. However, you can specify a custom grid setup if you would like. The three options
|
||||
# are column_count (the number of columns you want your grid to have), column width (the width in pixels that you want your columns to be), and
|
||||
# gutter_width (the width in pixels you want your gutters - space between columns - to be). To use the Blueprint default, do not define this
|
||||
# in your settings file.
|
||||
#
|
||||
# Semantic classes are still in the works within Blueprint, but a simple implementation has been created.
|
||||
#
|
||||
# Defining semantic_classes, with nodes underneath, will generate a class for each node which has rules of each class assigned to it. For example,
|
||||
# in project2 above, for '#footer, #header', elements with id's of footer and header will be assigned all the rules from the
|
||||
# classes 'span-24, column, and last', while divs with classes either entry or section, as well as any element with class of feed, is
|
||||
# assigned all the rules from 'span-6 and column'. Although it is a crude way do accomplish this, it keeps the generated CSS separate from the core BP CSS.
|
||||
#
|
||||
# Also supported is plugins. The compressor looks within BLUEPRINT_DIR/blueprint/plugins to match against what's passed. If the plugin name
|
||||
# matches, it will append PLUGIN/(screen|print|ie).css to the corresponding CSS file. It will append the plugin CSS to all three CSS files if
|
||||
# there is a CSS file present named as the plugin (e.g. the fancy-type plugin with a fancy-type.css file found within the plugin directory)
|
||||
#
|
||||
# In Ruby, the structure would look like this:
|
||||
#
|
||||
# {
|
||||
# 'project1' => {
|
||||
# 'path' => '/path/to/my/project/stylesheets',
|
||||
# 'namespace' => 'custom-namespace-1-',
|
||||
# 'custom_css' => {
|
||||
# 'ie.css' => ['custom-ie.css'],
|
||||
# 'print.css' => ['docs.css', 'my-print-styles.css'],
|
||||
# 'screen.css' => ['subfolder-of-stylesheets/sub_css.css']
|
||||
# },
|
||||
# 'custom_layout' => {
|
||||
# 'column_count' => 12,
|
||||
# 'column_width' => 70,
|
||||
# 'gutter_width' => 10
|
||||
# }
|
||||
# },
|
||||
# 'project2' => {
|
||||
# 'path' => '/path/to/different/stylesheets',
|
||||
# 'namespace' => 'different-namespace-',
|
||||
# 'custom_css' => {
|
||||
# 'screen.css' => ['custom_screen.css']
|
||||
# },
|
||||
# 'semantic_classes' => {
|
||||
# '#footer, #header' => 'column span-24 last',
|
||||
# '#content' => 'column span-18 border',
|
||||
# '#extra-content' => 'last span-6 column',
|
||||
# 'div#navigation' => 'last span-24 column',
|
||||
# 'div.section, div.entry, .feeds' => 'span-6 column'
|
||||
# },
|
||||
# 'plugins' => ['fancy-type', 'buttons', 'validations']
|
||||
# },
|
||||
# 'project3' => {
|
||||
# 'path' => '/path/to/another/projects/styles'
|
||||
# }
|
||||
# }
|
||||
|
||||
Blueprint::Compressor.new.generate!
|
|
@ -0,0 +1,33 @@
|
|||
# refer to http://www.yaml.org/spec/1.1/ for clarification on YAML collections
|
||||
project1:
|
||||
path: /path/to/my/project/stylesheets
|
||||
namespace: custom-namespace-1-
|
||||
custom_css:
|
||||
ie.css:
|
||||
- custom-ie.css
|
||||
print.css:
|
||||
- docs.css
|
||||
- my-print-styles.css
|
||||
screen.css:
|
||||
- subfolder-of-stylesheets/sub_css.css
|
||||
custom_layout:
|
||||
column_count: 12
|
||||
column_width: 70
|
||||
gutter_width: 10
|
||||
plugins:
|
||||
- fancy-type
|
||||
- buttons
|
||||
project2:
|
||||
path: /path/to/different/stylesheets
|
||||
namespace: different-namespace-
|
||||
custom_css:
|
||||
screen.css:
|
||||
- custom_screen.css
|
||||
semantic_classes:
|
||||
"#footer, #header": ".span-24, div.span-24"
|
||||
"#content": ".span-17, div.span-17, div.colborder"
|
||||
"#extra-content": ".span-6, div.span-6"
|
||||
"div#navigation": "div.span_24, .span-24"
|
||||
"div.section, div.entry, .feeds": ".span-6 div.span-6"
|
||||
project3:
|
||||
path: /path/to/another/projects/styles
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
require 'blueprint/blueprint'
|
||||
require 'blueprint/validator'
|
||||
|
||||
# This script will validate the core Blueprint files.
|
||||
#
|
||||
# The files are not completely valid. This has to do
|
||||
# with a small number of CSS hacks needed to ensure
|
||||
# consistent rendering across browsers.
|
||||
#
|
||||
# To add your own CSS files for validation, see
|
||||
# /lib/blueprint/validator.rb
|
||||
|
||||
Blueprint::Validator.new.validate
|
Loading…
Add table
Add a link
Reference in a new issue