staticmatic 0.11.0.alpha.6 → 0.11.0.alpha.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 0
3
3
  :minor: 11
4
4
  :patch: 0
5
- :build: alpha.6
5
+ :build: alpha.7
@@ -27,7 +27,7 @@ module StaticMatic
27
27
  # Bit of a hack here - adds any stylesheets that exist in the site/ dir that haven't been generated from source sass
28
28
  Dir[File.join(@staticmatic.site_dir, 'stylesheets', '*.css')].each do |filename|
29
29
  search_filename = File.basename(filename).chomp(File.extname(filename))
30
-
30
+ puts search_filename
31
31
  already_included = false
32
32
  stylesheet_directories.each do |path|
33
33
  if File.basename(path).include?(search_filename)
@@ -44,9 +44,11 @@ module StaticMatic
44
44
  filename_without_extension = File.basename(path).chomp(File.extname(path))
45
45
 
46
46
  if !filename_without_extension.match(/^\_/)
47
- path = path.gsub(/#{@staticmatic.base_dir}\/(src|site)\//, "").
48
- gsub(/#{filename_without_extension}\.(sass|scss|css)/, "")
49
-
47
+
48
+ path = path.gsub(/#{@staticmatic.src_dir}/, "").
49
+ gsub(/#{@staticmatic.site_dir}/, "").
50
+ gsub(/#{filename_without_extension}\.(sass|scss|css)/, "")
51
+
50
52
  options[:href] = "#{relative_path}#{path}#{filename_without_extension}.css"
51
53
  output << tag(:link, options)
52
54
  end
@@ -80,17 +80,21 @@ module StaticMatic::RenderMixin
80
80
  # full_file_path = File.join(@src_dir, 'stylesheets', source_dir, "#{source}.sass")
81
81
  full_file_path = Dir[File.join(@src_dir, 'stylesheets', source_dir, "#{source}.{sass,scss}")].first
82
82
 
83
- begin
84
- sass_options = { :load_paths => [ File.join(@src_dir, 'stylesheets') ] }.merge(self.configuration.sass_options)
85
-
86
- if File.extname(full_file_path) == ".scss"
87
- sass_options[:syntax] = :scss
88
- end
83
+ if full_file_path && File.exist?(full_file_path)
84
+ begin
85
+ sass_options = { :load_paths => [ File.join(@src_dir, 'stylesheets') ] }.merge(self.configuration.sass_options)
89
86
 
90
- stylesheet = Sass::Engine.new(File.read(full_file_path), sass_options)
91
- stylesheet.to_css
92
- rescue Exception => e
93
- render_rescue_from_error(StaticMatic::TemplateError.new(full_file_path, e))
87
+ if File.extname(full_file_path) == ".scss"
88
+ sass_options[:syntax] = :scss
89
+ end
90
+
91
+ stylesheet = Sass::Engine.new(File.read(full_file_path), sass_options)
92
+ stylesheet.to_css
93
+ rescue Exception => e
94
+ render_rescue_from_error(StaticMatic::TemplateError.new(full_file_path, e))
95
+ end
96
+ else
97
+ raise StaticMatic::Error.new("", source, "Stylesheet not found")
94
98
  end
95
99
  end
96
100
 
@@ -6,13 +6,17 @@ class StaticMatic::TemplateError < StandardError
6
6
  def initialize(template, original_exception)
7
7
  @template, @original_exception = template, original_exception
8
8
  @backtrace = original_exception.backtrace
9
-
10
- @source = File.read(template)
9
+
10
+ if template
11
+ @source = File.read(template)
12
+ else
13
+ @source = ""
14
+ end
11
15
  end
12
16
 
13
17
  # TODO: Replace 'haml|sass' with any registered engines
14
18
  def line_number
15
- @line_number ||= $2 if backtrace.find { |line| line =~ /\((haml|sass)\)\:(\d+)/ }
19
+ @line_number ||= $2 if backtrace.find { |line| line =~ /\((haml|sass|scss)\)\:(\d+)/ }
16
20
  end
17
21
 
18
22
  def filename
metadata CHANGED
@@ -7,8 +7,8 @@ version: !ruby/object:Gem::Version
7
7
  - 11
8
8
  - 0
9
9
  - alpha
10
- - 6
11
- version: 0.11.0.alpha.6
10
+ - 7
11
+ version: 0.11.0.alpha.7
12
12
  platform: ruby
13
13
  authors:
14
14
  - Stephen Bartholomew