jsmestad-compass 0.4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest +175 -0
- data/README.markdown +17 -0
- data/Rakefile +125 -0
- data/VERSION +1 -0
- data/bin/compass +8 -0
- data/compass.gemspec +37 -0
- data/examples/blueprint_default/index.html +73 -0
- data/examples/blueprint_default/parts/elements.html +246 -0
- data/examples/blueprint_default/parts/forms.html +100 -0
- data/examples/blueprint_default/parts/grid.html +206 -0
- data/examples/blueprint_default/parts/test-small.jpg +0 -0
- data/examples/blueprint_default/parts/test.jpg +0 -0
- data/examples/blueprint_default/parts/valid.png +0 -0
- data/examples/blueprint_default/stylesheets/ie.sass +3 -0
- data/examples/blueprint_default/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_default/stylesheets/print.sass +3 -0
- data/examples/blueprint_default/stylesheets/screen.sass +8 -0
- data/examples/blueprint_plugins/index.html +60 -0
- data/examples/blueprint_plugins/parts/fancy_type.html +84 -0
- data/examples/blueprint_plugins/parts/test-small.jpg +0 -0
- data/examples/blueprint_plugins/parts/test.jpg +0 -0
- data/examples/blueprint_plugins/parts/valid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/ie.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_plugins/stylesheets/print.sass +3 -0
- data/examples/blueprint_plugins/stylesheets/screen.sass +11 -0
- data/examples/blueprint_scoped/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped/stylesheets/screen.sass +4 -0
- data/examples/blueprint_scoped_form/stylesheets/ie.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/print.sass +3 -0
- data/examples/blueprint_scoped_form/stylesheets/screen.sass +10 -0
- data/examples/blueprint_semantic/index.html +68 -0
- data/examples/blueprint_semantic/parts/fancy_type.html +84 -0
- data/examples/blueprint_semantic/parts/liquid.html +84 -0
- data/examples/blueprint_semantic/parts/test-small.jpg +0 -0
- data/examples/blueprint_semantic/parts/test.jpg +0 -0
- data/examples/blueprint_semantic/parts/valid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/ie.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/images/grid.png +0 -0
- data/examples/blueprint_semantic/stylesheets/liquid.sass +70 -0
- data/examples/blueprint_semantic/stylesheets/print.sass +3 -0
- data/examples/blueprint_semantic/stylesheets/screen.sass +69 -0
- data/examples/compass/compass.html +19 -0
- data/examples/compass/sticky_footer.html.haml +14 -0
- data/examples/compass/stylesheets/compass.sass +47 -0
- data/examples/compass/stylesheets/images/blue_arrow.gif +0 -0
- data/examples/compass/stylesheets/sticky_footer.sass +11 -0
- data/examples/compass/stylesheets/utilities.sass +65 -0
- data/examples/compass/utilities.html.haml +136 -0
- data/examples/yui/divisions.html.haml +179 -0
- data/examples/yui/index.html.haml +19 -0
- data/examples/yui/stylesheets/screen.sass +13 -0
- data/examples/yui/sub_divisions.html.haml +169 -0
- data/examples/yui/templates.html.haml +54 -0
- data/examples/yui/test.jpg +0 -0
- data/examples/yui/typography.html.haml +132 -0
- data/frameworks/blueprint.rb +2 -0
- data/frameworks/blueprint/lib/blueprint/constants.rb +17 -0
- data/frameworks/blueprint/lib/blueprint/grid_builder.rb +54 -0
- data/frameworks/blueprint/stylesheets/_blueprint.sass +3 -0
- data/frameworks/blueprint/stylesheets/blueprint/_ie.sass +49 -0
- data/frameworks/blueprint/stylesheets/blueprint/_print.sass +82 -0
- data/frameworks/blueprint/stylesheets/blueprint/_screen.sass +15 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_colors.sass +30 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_debug.sass +9 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_fancy_type.sass +81 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_form.sass +43 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_grid.sass +141 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_interaction.sass +58 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_liquid.sass +137 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_scaffolding.sass +46 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_typography.sass +153 -0
- data/frameworks/blueprint/stylesheets/blueprint/modules/_utilities.sass +37 -0
- data/frameworks/blueprint/templates/project/grid.png +0 -0
- data/frameworks/blueprint/templates/project/ie.sass +3 -0
- data/frameworks/blueprint/templates/project/manifest.rb +5 -0
- data/frameworks/blueprint/templates/project/print.sass +3 -0
- data/frameworks/blueprint/templates/project/screen.sass +8 -0
- data/frameworks/compass.rb +2 -0
- data/frameworks/compass/stylesheets/_compass.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_layout.sass +1 -0
- data/frameworks/compass/stylesheets/compass/_reset.sass +3 -0
- data/frameworks/compass/stylesheets/compass/_utilities.sass +5 -0
- data/frameworks/compass/stylesheets/compass/layout/_sticky_footer.sass +17 -0
- data/frameworks/compass/stylesheets/compass/utilities/_general.sass +4 -0
- data/frameworks/compass/stylesheets/compass/utilities/_links.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_lists.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/_print.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/_tables.sass +1 -0
- data/frameworks/compass/stylesheets/compass/utilities/_text.sass +2 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.sass +11 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_inline_block.sass +6 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_reset.sass +58 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tabs.sass +0 -0
- data/frameworks/compass/stylesheets/compass/utilities/general/_tag_cloud.sass +19 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_hover_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_link_colors.sass +24 -0
- data/frameworks/compass/stylesheets/compass/utilities/links/_unstyled_link.sass +5 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_bullets.sass +21 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_horizontal_list.sass +20 -0
- data/frameworks/compass/stylesheets/compass/utilities/lists/_inline_list.sass +29 -0
- data/frameworks/compass/stylesheets/compass/utilities/tables/_alternating_rows_and_columns.sass +25 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_nowrap.sass +3 -0
- data/frameworks/compass/stylesheets/compass/utilities/text/_replacement.sass +10 -0
- data/frameworks/compass/templates/project/ie.sass +6 -0
- data/frameworks/compass/templates/project/manifest.rb +3 -0
- data/frameworks/compass/templates/project/print.sass +6 -0
- data/frameworks/compass/templates/project/screen.sass +7 -0
- data/frameworks/yui.rb +2 -0
- data/frameworks/yui/COPYRIGHT +15 -0
- data/frameworks/yui/stylesheets/_yui.sass +7 -0
- data/frameworks/yui/stylesheets/yui/modules/_base.sass +60 -0
- data/frameworks/yui/stylesheets/yui/modules/_fonts.sass +38 -0
- data/frameworks/yui/stylesheets/yui/modules/_grids.sass +341 -0
- data/frameworks/yui/templates/project/manifest.rb +1 -0
- data/frameworks/yui/templates/project/screen.sass +4 -0
- data/lib/compass.rb +39 -0
- data/lib/compass/actions.rb +92 -0
- data/lib/compass/commands/base.rb +26 -0
- data/lib/compass/commands/create_project.rb +41 -0
- data/lib/compass/commands/list_frameworks.rb +16 -0
- data/lib/compass/commands/print_version.rb +23 -0
- data/lib/compass/commands/project_base.rb +74 -0
- data/lib/compass/commands/update_project.rb +61 -0
- data/lib/compass/commands/watch_project.rb +53 -0
- data/lib/compass/compiler.rb +40 -0
- data/lib/compass/configuration.rb +92 -0
- data/lib/compass/core_ext.rb +12 -0
- data/lib/compass/errors.rb +7 -0
- data/lib/compass/exec.rb +184 -0
- data/lib/compass/frameworks.rb +29 -0
- data/lib/compass/installers.rb +5 -0
- data/lib/compass/installers/base.rb +135 -0
- data/lib/compass/installers/manifest.rb +57 -0
- data/lib/compass/installers/rails.rb +125 -0
- data/lib/compass/installers/stand_alone.rb +76 -0
- data/lib/compass/logger.rb +34 -0
- data/lib/compass/merb.rb +43 -0
- data/lib/compass/test_case.rb +37 -0
- data/lib/compass/validate.rb +13 -0
- data/lib/compass/validate/COPYRIGHT.html +93 -0
- data/lib/compass/validate/JIGSAW_COPYRIGHT +64 -0
- data/lib/compass/validate/README.html +83 -0
- data/lib/compass/validate/XERCES_COPYING.txt +56 -0
- data/lib/compass/validate/css-validator-javadoc.jar +0 -0
- data/lib/compass/validate/css-validator.jar +0 -0
- data/lib/compass/validate/jigsaw.jar +0 -0
- data/lib/compass/validate/xerces.jar +0 -0
- data/lib/compass/validator.rb +59 -0
- data/lib/compass/version.rb +66 -0
- data/lib/sass_extensions.rb +13 -0
- data/test/command_line_test.rb +147 -0
- data/test/compass_test.rb +148 -0
- data/test/configuration_test.rb +28 -0
- data/test/fixtures/stylesheets/blueprint/css/typography.css +158 -0
- data/test/fixtures/stylesheets/blueprint/sass/ie.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/print.sass +3 -0
- data/test/fixtures/stylesheets/blueprint/sass/screen.sass +17 -0
- data/test/fixtures/stylesheets/blueprint/sass/typography.sass +3 -0
- data/test/fixtures/stylesheets/compass/css/layout.css +14 -0
- data/test/fixtures/stylesheets/compass/css/print.css +19 -0
- data/test/fixtures/stylesheets/compass/css/reset.css +69 -0
- data/test/fixtures/stylesheets/compass/css/utilities.css +21 -0
- data/test/fixtures/stylesheets/compass/sass/layout.sass +3 -0
- data/test/fixtures/stylesheets/compass/sass/print.sass +5 -0
- data/test/fixtures/stylesheets/compass/sass/reset.sass +1 -0
- data/test/fixtures/stylesheets/compass/sass/utilities.sass +5 -0
- data/test/fixtures/stylesheets/yui/css/mixins.css +16 -0
- data/test/fixtures/stylesheets/yui/sass/base.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/fonts.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/grids.sass +3 -0
- data/test/fixtures/stylesheets/yui/sass/mixins.sass +16 -0
- data/test/sass_extensions_test.rb +26 -0
- data/test/test_helper.rb +47 -0
- metadata +291 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class Base
|
4
|
+
|
5
|
+
include Actions
|
6
|
+
|
7
|
+
attr_accessor :working_path, :options
|
8
|
+
|
9
|
+
def initialize(working_path, options)
|
10
|
+
self.working_path = working_path
|
11
|
+
self.options = options
|
12
|
+
end
|
13
|
+
|
14
|
+
def perform
|
15
|
+
raise StandardError.new("Not Implemented")
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def framework
|
21
|
+
Compass::Frameworks[options[:framework]]
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require File.join(File.dirname(__FILE__), 'base')
|
3
|
+
require File.join(File.dirname(__FILE__), 'update_project')
|
4
|
+
require File.join(Compass.lib_directory, 'compass', 'installers')
|
5
|
+
|
6
|
+
module Compass
|
7
|
+
module Commands
|
8
|
+
class CreateProject < ProjectBase
|
9
|
+
|
10
|
+
include Compass::Installers
|
11
|
+
|
12
|
+
attr_accessor :installer
|
13
|
+
|
14
|
+
def initialize(working_path, options)
|
15
|
+
super(working_path, options)
|
16
|
+
installer_args = [project_template_directory, project_directory, self.options]
|
17
|
+
@installer = case options[:project_type]
|
18
|
+
when :stand_alone
|
19
|
+
StandAloneInstaller.new *installer_args
|
20
|
+
when :rails
|
21
|
+
RailsInstaller.new *installer_args
|
22
|
+
else
|
23
|
+
raise "Unknown project type: #{project_type}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# all commands must implement perform
|
28
|
+
def perform
|
29
|
+
installer.init
|
30
|
+
installer.run(:skip_finalization => true)
|
31
|
+
UpdateProject.new(working_path, options).perform if installer.compilation_required?
|
32
|
+
installer.finalize(:create => true)
|
33
|
+
end
|
34
|
+
|
35
|
+
def project_template_directory
|
36
|
+
File.join(framework.templates_directory, "project")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class ListFrameworks
|
4
|
+
attr_accessor :options
|
5
|
+
def initialize(working_path, options)
|
6
|
+
self.options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform
|
10
|
+
Compass::Frameworks::ALL.each do |framework|
|
11
|
+
puts framework.name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Compass
|
2
|
+
module Commands
|
3
|
+
class PrintVersion
|
4
|
+
attr_accessor :options
|
5
|
+
def initialize(working_path, options)
|
6
|
+
self.options = options
|
7
|
+
end
|
8
|
+
|
9
|
+
def perform
|
10
|
+
if options[:quiet]
|
11
|
+
# The quiet option may make scripting easier
|
12
|
+
puts ::Compass.version[:string]
|
13
|
+
else
|
14
|
+
lines = []
|
15
|
+
lines << "Compass #{::Compass.version[:string]}"
|
16
|
+
lines << "Copyright (c) 2008 Chris Eppstein"
|
17
|
+
lines << "Released under the MIT License."
|
18
|
+
puts lines.join("\n")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sass'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'pathname'
|
5
|
+
require File.join(File.dirname(__FILE__), 'base')
|
6
|
+
|
7
|
+
module Compass
|
8
|
+
module Commands
|
9
|
+
class ProjectBase < Base
|
10
|
+
attr_accessor :project_directory, :project_name, :options
|
11
|
+
|
12
|
+
def initialize(working_path, options = {})
|
13
|
+
super(working_path, options)
|
14
|
+
self.project_name = determine_project_name(working_path, options)
|
15
|
+
Compass.configuration.project_path = determine_project_directory(working_path, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def projectize(path)
|
21
|
+
File.join(project_directory, separate(path))
|
22
|
+
end
|
23
|
+
|
24
|
+
def project_directory
|
25
|
+
Compass.configuration.project_path
|
26
|
+
end
|
27
|
+
|
28
|
+
def project_css_subdirectory
|
29
|
+
Compass.configuration.css_dir
|
30
|
+
end
|
31
|
+
|
32
|
+
def project_src_subdirectory
|
33
|
+
Compass.configuration.sass_dir
|
34
|
+
end
|
35
|
+
|
36
|
+
# Read the configuration file for this project
|
37
|
+
def read_project_configuration
|
38
|
+
if File.exists?(projectize('config.rb'))
|
39
|
+
Compass.configuration.parse(projectize('config.rb'))
|
40
|
+
elsif File.exists?(projectize('src/config.rb'))
|
41
|
+
Compass.configuration.parse(projectize('src/config.rb'))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def determine_project_name(working_path, options)
|
48
|
+
if options[:project_name]
|
49
|
+
File.basename(strip_trailing_separator(options[:project_name]))
|
50
|
+
else
|
51
|
+
File.basename(working_path)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def determine_project_directory(working_path, options)
|
56
|
+
if options[:project_name]
|
57
|
+
if absolute_path?(options[:project_name])
|
58
|
+
options[:project_name]
|
59
|
+
else
|
60
|
+
File.join(working_path, options[:project_name])
|
61
|
+
end
|
62
|
+
else
|
63
|
+
working_path
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def absolute_path?(path)
|
68
|
+
# This is only going to work on unix, gonna need a better implementation.
|
69
|
+
path.index(File::SEPARATOR) == 0
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'project_base')
|
2
|
+
require File.join(Compass.lib_directory, 'compass', 'compiler')
|
3
|
+
|
4
|
+
module Compass
|
5
|
+
module Commands
|
6
|
+
class UpdateProject < ProjectBase
|
7
|
+
|
8
|
+
def initialize(working_path, options)
|
9
|
+
super
|
10
|
+
assert_project_directory_exists!
|
11
|
+
end
|
12
|
+
|
13
|
+
def perform
|
14
|
+
read_project_configuration
|
15
|
+
default_options = { :style => default_output_style }
|
16
|
+
compilation_options = default_options.merge(options).merge(:load_paths => sass_load_paths)
|
17
|
+
Compass::Compiler.new(working_path,
|
18
|
+
projectize(project_src_subdirectory),
|
19
|
+
projectize(project_css_subdirectory),
|
20
|
+
compilation_options).run
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_output_style
|
24
|
+
if options[:environment] == :development
|
25
|
+
:expanded
|
26
|
+
else
|
27
|
+
:compact
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# where to load sass files from
|
32
|
+
def sass_load_paths
|
33
|
+
[project_src_directory] + Compass::Frameworks::ALL.map{|f| f.stylesheets_directory}
|
34
|
+
end
|
35
|
+
|
36
|
+
# The subdirectory where the sass source is kept.
|
37
|
+
def project_src_subdirectory
|
38
|
+
Compass.configuration.sass_dir ||= options[:src_dir] || "src"
|
39
|
+
end
|
40
|
+
|
41
|
+
# The subdirectory where the css output is kept.
|
42
|
+
def project_css_subdirectory
|
43
|
+
Compass.configuration.css_dir ||= options[:css_dir] || "stylesheets"
|
44
|
+
end
|
45
|
+
|
46
|
+
# The directory where the project source files are located.
|
47
|
+
def project_src_directory
|
48
|
+
@project_src_directory ||= separate("#{project_directory}/#{project_src_subdirectory}")
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_project_directory_exists!
|
52
|
+
if File.exists?(project_directory) && !File.directory?(project_directory)
|
53
|
+
raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.")
|
54
|
+
elsif !File.directory?(project_directory)
|
55
|
+
raise Compass::Error.new("#{project_directory} does not exist.")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'sass'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'pathname'
|
5
|
+
require File.join(File.dirname(__FILE__), 'base')
|
6
|
+
require File.join(File.dirname(__FILE__), 'update_project')
|
7
|
+
|
8
|
+
module Compass
|
9
|
+
module Commands
|
10
|
+
class WatchProject < UpdateProject
|
11
|
+
|
12
|
+
attr_accessor :last_update_time
|
13
|
+
|
14
|
+
def perform
|
15
|
+
puts ">>> Compiling all stylesheets."
|
16
|
+
super
|
17
|
+
self.last_update_time = most_recent_update_time
|
18
|
+
puts ">>> Compass is now watching for changes. Press Ctrl-C to Stop."
|
19
|
+
loop do
|
20
|
+
# TODO: Make this efficient by using filesystem monitoring.
|
21
|
+
begin
|
22
|
+
sleep 1
|
23
|
+
rescue Interrupt
|
24
|
+
puts ""
|
25
|
+
exit 0
|
26
|
+
end
|
27
|
+
file, t = should_update?
|
28
|
+
if t
|
29
|
+
begin
|
30
|
+
puts ">>> Change detected to: #{file}"
|
31
|
+
super
|
32
|
+
rescue StandardError => e
|
33
|
+
::Compass::Exec.report_error(e, options)
|
34
|
+
end
|
35
|
+
self.last_update_time = t
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def most_recent_update_time
|
41
|
+
Dir.glob(separate("#{project_src_directory}/**/*.sass")).map {|sass_file| File.stat(sass_file).mtime}.max
|
42
|
+
end
|
43
|
+
|
44
|
+
def should_update?
|
45
|
+
t = most_recent_update_time
|
46
|
+
if t > last_update_time
|
47
|
+
file = Dir.glob(separate("#{project_src_directory}/**/*.sass")).detect {|sass_file| File.stat(sass_file).mtime >= t}
|
48
|
+
[file, t]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Compass
|
2
|
+
class Compiler
|
3
|
+
|
4
|
+
include Actions
|
5
|
+
|
6
|
+
attr_accessor :working_path, :from, :to, :options
|
7
|
+
|
8
|
+
def initialize(working_path, from, to, options)
|
9
|
+
self.working_path = working_path
|
10
|
+
self.from, self.to = from, to
|
11
|
+
self.logger = options.delete(:logger)
|
12
|
+
self.options = options
|
13
|
+
end
|
14
|
+
|
15
|
+
def sass_files
|
16
|
+
@sass_files || Dir.glob(separate("#{from}/**/[^_]*.sass"))
|
17
|
+
end
|
18
|
+
|
19
|
+
def stylesheet_name(sass_file)
|
20
|
+
sass_file[("#{from}/".length)..-6]
|
21
|
+
end
|
22
|
+
|
23
|
+
def css_files
|
24
|
+
@css_files || sass_files.map{|sass_file| "#{to}/#{stylesheet_name(sass_file)}.css"}
|
25
|
+
end
|
26
|
+
|
27
|
+
def target_directories
|
28
|
+
css_files.map{|css_file| File.dirname(css_file)}.uniq.sort.sort_by{|d| d.length }
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
target_directories.each do |dir|
|
33
|
+
directory dir
|
34
|
+
end
|
35
|
+
sass_files.zip(css_files).each do |sass_filename, css_filename|
|
36
|
+
compile sass_filename, css_filename, options
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
|
3
|
+
module Compass
|
4
|
+
class Configuration
|
5
|
+
include Singleton
|
6
|
+
attr_accessor :project_path, :css_dir, :sass_dir, :images_dir, :javascripts_dir, :required_libraries
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
self.required_libraries = []
|
10
|
+
end
|
11
|
+
|
12
|
+
# parses a manifest file which is a ruby script
|
13
|
+
# evaluated in a Manifest instance context
|
14
|
+
def parse(config_file)
|
15
|
+
open(config_file) do |f|
|
16
|
+
parse_string(f.read, config_file)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse_string(contents, filename)
|
21
|
+
eval(contents, binding, filename)
|
22
|
+
[:css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |prop|
|
23
|
+
value = eval(prop.to_s, binding) rescue nil
|
24
|
+
self.send("#{prop}=", value) if value
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def serialize
|
29
|
+
contents = ""
|
30
|
+
required_libraries.each do |lib|
|
31
|
+
contents << %Q{require '#{lib}'\n}
|
32
|
+
end
|
33
|
+
contents << "\n" if required_libraries.any?
|
34
|
+
[:css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |prop|
|
35
|
+
value = send(prop)
|
36
|
+
contents << %Q(#{prop} = "#{value}"\n) if value
|
37
|
+
end
|
38
|
+
contents
|
39
|
+
end
|
40
|
+
|
41
|
+
# Support for testing.
|
42
|
+
def reset!
|
43
|
+
[:project_path, :css_dir, :sass_dir, :images_dir, :javascripts_dir].each do |attr|
|
44
|
+
send("#{attr}=", nil)
|
45
|
+
end
|
46
|
+
self.required_libraries = []
|
47
|
+
end
|
48
|
+
|
49
|
+
def require(lib)
|
50
|
+
required_libraries << lib
|
51
|
+
super
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
module ConfigHelpers
|
57
|
+
def configuration
|
58
|
+
if block_given?
|
59
|
+
yield Configuration.instance
|
60
|
+
end
|
61
|
+
Configuration.instance
|
62
|
+
end
|
63
|
+
|
64
|
+
def sass_plugin_configuration
|
65
|
+
proj_sass_path = File.join(configuration.project_path, configuration.sass_dir)
|
66
|
+
proj_css_path = File.join(configuration.project_path, configuration.css_dir)
|
67
|
+
locations = {proj_sass_path => proj_css_path}
|
68
|
+
Compass::Frameworks::ALL.each do |framework|
|
69
|
+
locations[framework.stylesheets_directory] = proj_css_path
|
70
|
+
end
|
71
|
+
{:template_location => locations}
|
72
|
+
end
|
73
|
+
|
74
|
+
def configure_sass_plugin!
|
75
|
+
Sass::Plugin.options.merge!(sass_plugin_configuration)
|
76
|
+
end
|
77
|
+
|
78
|
+
def sass_engine_options
|
79
|
+
load_paths = []
|
80
|
+
if configuration.project_path && configuration.sass_dir
|
81
|
+
load_paths << File.join(configuration.project_path, configuration.sass_dir)
|
82
|
+
end
|
83
|
+
Compass::Frameworks::ALL.each do |framework|
|
84
|
+
load_paths << framework.stylesheets_directory
|
85
|
+
end
|
86
|
+
{:load_paths => load_paths}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
extend ConfigHelpers
|
91
|
+
|
92
|
+
end
|