smallvictories 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/sassc/compressor.rb +21 -0
- data/lib/sassc/functions.rb +12 -0
- data/lib/sassc/importer.rb +127 -0
- data/lib/sassc/template.rb +103 -0
- data/lib/smallvictories/builder.rb +6 -4
- data/lib/smallvictories/compiler.rb +19 -19
- data/lib/smallvictories/configuration.rb +20 -4
- data/lib/smallvictories/constants.rb +4 -2
- data/lib/smallvictories/version.rb +1 -1
- data/lib/smallvictories.rb +4 -0
- data/spec/builder_spec.rb +3 -3
- data/spec/configuration_spec.rb +14 -6
- data/spec/fixtures/source/_sv_config.yml +4 -2
- data/src/Guardfile +1 -30
- data/src/config.yml +1 -6
- metadata +14 -12
- data/spec/fixtures/destinationindex.html +0 -5
- /data/spec/fixtures/{destination_sv_custom.css → destination/application.css} +0 -0
- /data/spec/fixtures/{destination_sv_custom.js → destination/application.js} +0 -0
- /data/spec/fixtures/source/{_sv_custom.css → application.css} +0 -0
- /data/spec/fixtures/source/{_sv_custom.js → application.js} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7697d9131ed7aff89a85cfb9d647c54eddb738ef
|
4
|
+
data.tar.gz: 430eb38894186c232db4d6809442d4ea3f05ec4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f3c000d54497e043fa347ab8b5242902c97a859b2a63fb54e45eb4fa01179fce958064e4e27c0f1ee68d3cb00c8b6935fd1a3ccf40beb99b5055eca17e444b6
|
7
|
+
data.tar.gz: 8b029ccf6bdbdabcc74a8c4f10c3cccab1586162cb1ec6884aec9db80daf39dd1f0beb3eb65945d9a052dd412381bed5302a55d68ba4fb24160570a81f55b183
|
data/README.md
CHANGED
@@ -74,8 +74,8 @@ Dropbox
|
|
74
74
|
│ ├── _includes
|
75
75
|
│ │ └── _head.liquid
|
76
76
|
│ ├── _layout.liquid
|
77
|
-
│ ├──
|
78
|
-
│ ├──
|
77
|
+
│ ├── application.css
|
78
|
+
│ ├── application.js
|
79
79
|
│ └── index.liquid
|
80
80
|
│
|
81
81
|
├── _sv_custom.css
|
@@ -137,8 +137,10 @@ You can set the following options:
|
|
137
137
|
```yaml
|
138
138
|
source: '_'
|
139
139
|
destination: ''
|
140
|
-
|
141
|
-
|
140
|
+
source_stylesheet: 'application.css'
|
141
|
+
source_javascript: 'application.js'
|
142
|
+
destination_stylesheet: '_sv_custom.css'
|
143
|
+
destination_javascript: '_sv_custom.js'
|
142
144
|
layout: '_layout.liquid'
|
143
145
|
includes: '_includes'
|
144
146
|
```
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'sprockets/sass_compressor'
|
2
|
+
|
3
|
+
class Sprockets::SassCompressor
|
4
|
+
def call(*args)
|
5
|
+
input = if defined?(data)
|
6
|
+
data # sprockets 2.x
|
7
|
+
else
|
8
|
+
args[0][:data] #sprockets 3.x
|
9
|
+
end
|
10
|
+
|
11
|
+
SassC::Engine.new(
|
12
|
+
input,
|
13
|
+
{
|
14
|
+
style: :compressed
|
15
|
+
}
|
16
|
+
).render
|
17
|
+
end
|
18
|
+
|
19
|
+
# sprockets 2.x
|
20
|
+
alias :evaluate :call
|
21
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'sprockets/sass_functions'
|
2
|
+
require 'sassc'
|
3
|
+
|
4
|
+
module Sprockets
|
5
|
+
module SassFunctions
|
6
|
+
def asset_data_url(path)
|
7
|
+
SassC::Script::String.new("url(" + sprockets_context.asset_data_uri(path.value) + ")")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
::SassC::Script::Functions.send :include, Sprockets::SassFunctions
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
|
3
|
+
module SassC
|
4
|
+
module Rails
|
5
|
+
class Importer < SassC::Importer
|
6
|
+
class Extension
|
7
|
+
attr_reader :postfix
|
8
|
+
|
9
|
+
def initialize(postfix=nil)
|
10
|
+
@postfix = postfix
|
11
|
+
end
|
12
|
+
|
13
|
+
def import_for(full_path, parent_dir, options)
|
14
|
+
SassC::Importer::Import.new(full_path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
class CSSExtension
|
19
|
+
def postfix
|
20
|
+
".css"
|
21
|
+
end
|
22
|
+
|
23
|
+
def import_for(full_path, parent_dir, options)
|
24
|
+
import_path = full_path.gsub(/\.css$/,"")
|
25
|
+
SassC::Importer::Import.new(import_path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
EXTENSIONS = [
|
30
|
+
Extension.new(".scss"),
|
31
|
+
Extension.new(".sass"),
|
32
|
+
CSSExtension.new
|
33
|
+
]
|
34
|
+
|
35
|
+
PREFIXS = [ "", "_" ]
|
36
|
+
GLOB = /(\A|\/)(\*|\*\*\/\*)\z/
|
37
|
+
|
38
|
+
def imports(path, parent_path)
|
39
|
+
parent_dir, _ = File.split(parent_path)
|
40
|
+
specified_dir, specified_file = File.split(path)
|
41
|
+
|
42
|
+
if m = path.match(GLOB)
|
43
|
+
path = path.sub(m[0], "")
|
44
|
+
base = File.expand_path(path, File.dirname(parent_path))
|
45
|
+
return glob_imports(base, m[2], parent_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
search_paths = ([parent_dir] + load_paths).uniq
|
49
|
+
|
50
|
+
if specified_dir != "."
|
51
|
+
search_paths.map! do |path|
|
52
|
+
File.join(path, specified_dir)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
search_paths.each do |search_path|
|
57
|
+
PREFIXS.each do |prefix|
|
58
|
+
file_name = prefix + specified_file
|
59
|
+
|
60
|
+
EXTENSIONS.each do |extension|
|
61
|
+
try_path = File.join(search_path, file_name + extension.postfix)
|
62
|
+
if File.exists?(try_path)
|
63
|
+
record_import_as_dependency try_path
|
64
|
+
return extension.import_for(try_path, parent_dir, options)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
SassC::Importer::Import.new(path)
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def extension_for_file(file)
|
76
|
+
EXTENSIONS.detect do |extension|
|
77
|
+
file.include? extension.postfix
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def record_import_as_dependency(path)
|
82
|
+
context.depend_on path
|
83
|
+
end
|
84
|
+
|
85
|
+
def context
|
86
|
+
options[:sprockets][:context]
|
87
|
+
end
|
88
|
+
|
89
|
+
def load_paths
|
90
|
+
options[:load_paths]
|
91
|
+
end
|
92
|
+
|
93
|
+
def glob_imports(base, glob, current_file)
|
94
|
+
files = globbed_files(base, glob)
|
95
|
+
files = files.reject { |f| f == current_file }
|
96
|
+
|
97
|
+
files.map do |filename|
|
98
|
+
record_import_as_dependency(filename)
|
99
|
+
extension = extension_for_file(filename)
|
100
|
+
extension.import_for(filename, base, options)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def globbed_files(base, glob)
|
105
|
+
# TODO: Raise an error from SassC here
|
106
|
+
raise ArgumentError unless glob == "*" || glob == "**/*"
|
107
|
+
|
108
|
+
extensions = EXTENSIONS.map(&:postfix)
|
109
|
+
exts = extensions.map { |ext| Regexp.escape("#{ext}") }.join("|")
|
110
|
+
sass_re = Regexp.compile("(#{exts})$")
|
111
|
+
|
112
|
+
record_import_as_dependency(base)
|
113
|
+
|
114
|
+
files = Dir["#{base}/#{glob}"].sort.map do |path|
|
115
|
+
if File.directory?(path)
|
116
|
+
record_import_as_dependency(path)
|
117
|
+
nil
|
118
|
+
elsif sass_re =~ path
|
119
|
+
path
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
files.compact
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require "sprockets/version"
|
2
|
+
require "sprockets/sass_template"
|
3
|
+
require "sprockets/utils"
|
4
|
+
|
5
|
+
module SassC::Rails
|
6
|
+
class SassTemplate < Sprockets::SassTemplate
|
7
|
+
module Sprockets3
|
8
|
+
def call(input)
|
9
|
+
context = input[:environment].context_class.new(input)
|
10
|
+
|
11
|
+
options = {
|
12
|
+
filename: input[:filename],
|
13
|
+
line_comments: line_comments?,
|
14
|
+
syntax: self.class.syntax,
|
15
|
+
load_paths: input[:environment].paths,
|
16
|
+
importer: SassC::Rails::Importer,
|
17
|
+
sprockets: {
|
18
|
+
context: context,
|
19
|
+
environment: input[:environment],
|
20
|
+
dependencies: context.metadata[:dependency_paths]
|
21
|
+
}
|
22
|
+
}.merge(config_options)
|
23
|
+
|
24
|
+
engine = ::SassC::Engine.new(input[:data], options)
|
25
|
+
|
26
|
+
css = Sprockets::Utils.module_include(::SassC::Script::Functions, @functions) do
|
27
|
+
engine.render
|
28
|
+
end
|
29
|
+
|
30
|
+
context.metadata.merge(data: css)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module Sprockets2
|
35
|
+
def self.included(base)
|
36
|
+
base.class_eval do
|
37
|
+
self.default_mime_type = "text/css"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def evaluate(context, locals, &block)
|
42
|
+
options = {
|
43
|
+
filename: eval_file,
|
44
|
+
line_comments: line_comments?,
|
45
|
+
syntax: syntax,
|
46
|
+
load_paths: context.environment.paths,
|
47
|
+
importer: SassC::Rails::Importer,
|
48
|
+
sprockets: {
|
49
|
+
context: context,
|
50
|
+
environment: context.environment
|
51
|
+
}
|
52
|
+
}.merge(config_options)
|
53
|
+
|
54
|
+
::SassC::Engine.new(data, options).render
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
if Sprockets::VERSION > "3.0.0"
|
59
|
+
include Sprockets3
|
60
|
+
else
|
61
|
+
include Sprockets2
|
62
|
+
end
|
63
|
+
|
64
|
+
def config_options
|
65
|
+
opts = { style: sass_style }
|
66
|
+
|
67
|
+
|
68
|
+
if Rails.application.config.sass.inline_source_maps
|
69
|
+
opts.merge!({
|
70
|
+
source_map_file: ".",
|
71
|
+
source_map_embed: true,
|
72
|
+
source_map_contents: true,
|
73
|
+
})
|
74
|
+
end
|
75
|
+
|
76
|
+
opts
|
77
|
+
end
|
78
|
+
|
79
|
+
def sass_style
|
80
|
+
(Rails.application.config.sass.style || :expanded).to_sym
|
81
|
+
end
|
82
|
+
|
83
|
+
def line_comments?
|
84
|
+
Rails.application.config.sass.line_comments
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class ScssTemplate < SassTemplate
|
89
|
+
unless Sprockets::VERSION > "3.0.0"
|
90
|
+
self.default_mime_type = 'text/css'
|
91
|
+
end
|
92
|
+
|
93
|
+
# Sprockets 3
|
94
|
+
def self.syntax
|
95
|
+
:scss
|
96
|
+
end
|
97
|
+
|
98
|
+
# Sprockets 2
|
99
|
+
def syntax
|
100
|
+
:scss
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
@@ -54,8 +54,10 @@ module SmallVictories
|
|
54
54
|
d = YAML::load_file(File.join(src_directory, 'config.yml'))
|
55
55
|
d['source'] = DEFAULT_SOURCE
|
56
56
|
d['destination'] = DEFAULT_DESTINATION
|
57
|
-
d['
|
58
|
-
d['
|
57
|
+
d['source_stylesheet'] = DEFAULT_SOURCE_STYLESHEET
|
58
|
+
d['source_javascript'] = DEFAULT_SOURCE_JAVASCRIPT
|
59
|
+
d['destination_stylesheet'] = DEFAULT_DESTINATION_STYLESHEET
|
60
|
+
d['destination_javascript'] = DEFAULT_DESTINATION_JAVASCRIPT
|
59
61
|
d['layout'] = DEFAULT_LAYOUT
|
60
62
|
d['includes'] = DEFAULT_INCLUDES
|
61
63
|
File.open(File.join(folder_path, CONFIG_FILE), 'w') {|f| f.write d.to_yaml }
|
@@ -66,11 +68,11 @@ module SmallVictories
|
|
66
68
|
end
|
67
69
|
|
68
70
|
def setup_stylesheet
|
69
|
-
create_src_file('stylesheet.css', File.join(folder_source_path, config.
|
71
|
+
create_src_file('stylesheet.css', File.join(folder_source_path, config.stylesheets.first))
|
70
72
|
end
|
71
73
|
|
72
74
|
def setup_javascript
|
73
|
-
create_src_file('javascript.js', File.join(folder_source_path, config.
|
75
|
+
create_src_file('javascript.js', File.join(folder_source_path, config.javascripts.first))
|
74
76
|
end
|
75
77
|
|
76
78
|
def setup_html
|
@@ -11,11 +11,11 @@ module SmallVictories
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def compile_css
|
14
|
-
package [config.
|
14
|
+
package [config.stylesheets]
|
15
15
|
end
|
16
16
|
|
17
17
|
def compile_js
|
18
|
-
package [config.
|
18
|
+
package [config.javascripts]
|
19
19
|
end
|
20
20
|
|
21
21
|
def compile_html
|
@@ -42,13 +42,14 @@ module SmallVictories
|
|
42
42
|
|
43
43
|
file = File.open(path).read
|
44
44
|
liquid = Liquid::Template.parse(file)
|
45
|
-
|
45
|
+
data = { 'config' => { 'stylesheet' => config.stylesheets.last, 'javascript' => config.javascripts.last } }
|
46
|
+
content = liquid.render(data)
|
46
47
|
output_file_name = file_name.concat('.html')
|
47
48
|
output_path = File.join(config.full_destination_path, output_file_name)
|
48
49
|
if layout
|
49
|
-
html = layout.render('content_for_layout' => liquid.render
|
50
|
+
html = layout.render(data.merge('content_for_layout' => liquid.render))
|
50
51
|
else
|
51
|
-
html = liquid.render(
|
52
|
+
html = liquid.render(data)
|
52
53
|
end
|
53
54
|
Dir.mkdir(config.full_destination_path) unless File.exists?(config.full_destination_path)
|
54
55
|
File.open(File.join(config.full_destination_path, output_file_name), 'w') { |file| file.write(html) }
|
@@ -59,22 +60,21 @@ module SmallVictories
|
|
59
60
|
end
|
60
61
|
end
|
61
62
|
|
62
|
-
def package bundles=[config.
|
63
|
-
sprockets = Sprockets::Environment.new(
|
63
|
+
def package bundles=[config.stylesheets, config.javascripts], options={}
|
64
|
+
sprockets = Sprockets::Environment.new(config.full_source_path) do |environment|
|
64
65
|
environment.gzip = true
|
65
66
|
environment.logger = SmallVictories.logger
|
66
67
|
environment.js_compressor = options[:js_compressor] || :uglify
|
67
68
|
environment.css_compressor = options[:css_compressor] || :sass
|
68
69
|
end
|
69
70
|
|
70
|
-
sprockets.append_path(
|
71
|
+
sprockets.append_path('.')
|
71
72
|
bundles.each do |bundle|
|
72
73
|
begin
|
73
|
-
if assets = sprockets.find_asset(bundle)
|
74
|
-
prefix, basename = assets.pathname.to_s.split('/')[-2..-1]
|
74
|
+
if assets = sprockets.find_asset(bundle.first)
|
75
75
|
FileUtils.mkpath config.full_destination_path
|
76
|
-
assets.write_to File.join(config.full_destination_path,
|
77
|
-
SmallVictories.logger.info "compiled #{config.destination}
|
76
|
+
assets.write_to File.join(config.full_destination_path, bundle.last)
|
77
|
+
SmallVictories.logger.info "compiled #{File.join(config.destination, bundle.last)}"
|
78
78
|
end
|
79
79
|
rescue => e
|
80
80
|
SmallVictories.logger.error "#{bundle}\n#{e}"
|
@@ -84,18 +84,18 @@ module SmallVictories
|
|
84
84
|
|
85
85
|
def prefix_css
|
86
86
|
begin
|
87
|
-
path = File.join(config.full_destination_path, config.
|
87
|
+
path = File.join(config.full_destination_path, config.stylesheets.last)
|
88
88
|
css = File.open(path).read
|
89
89
|
prefixed = AutoprefixerRails.process(css, browsers: ['last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1'], cascade: false)
|
90
90
|
File.open(path, 'w') { |file| file.write(prefixed.css) }
|
91
91
|
|
92
|
-
sprockets = Sprockets::Environment.new(
|
92
|
+
sprockets = Sprockets::Environment.new(config.full_source_path) do |environment|
|
93
93
|
environment.css_compressor = :yui
|
94
94
|
end
|
95
95
|
sprockets.append_path(config.full_destination_path)
|
96
|
-
if assets = sprockets.find_asset(config.
|
97
|
-
assets.write_to File.join(config.full_destination_path, config.
|
98
|
-
SmallVictories.logger.info "prefixed #{config.destination}/#{config.
|
96
|
+
if assets = sprockets.find_asset(config.stylesheets.last)
|
97
|
+
assets.write_to File.join(config.full_destination_path, config.stylesheets.last)
|
98
|
+
SmallVictories.logger.info "prefixed #{config.destination}/#{config.stylesheets.last}"
|
99
99
|
end
|
100
100
|
rescue => e
|
101
101
|
SmallVictories.logger.error "#{path}\n#{e}"
|
@@ -103,12 +103,12 @@ module SmallVictories
|
|
103
103
|
end
|
104
104
|
|
105
105
|
def minify_css
|
106
|
-
package [config.
|
106
|
+
package [config.stylesheets]
|
107
107
|
prefix_css
|
108
108
|
end
|
109
109
|
|
110
110
|
def minify_js
|
111
|
-
package [config.
|
111
|
+
package [config.javascripts], { js_compressor: :closure }
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
@@ -32,12 +32,28 @@ module SmallVictories
|
|
32
32
|
File.join(ROOT, destination)
|
33
33
|
end
|
34
34
|
|
35
|
-
def
|
36
|
-
config_file(:
|
35
|
+
def source_javascript
|
36
|
+
config_file(:source_javascript) || DEFAULT_SOURCE_JAVASCRIPT
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
config_file(:
|
39
|
+
def destination_javascript
|
40
|
+
config_file(:destination_javascript) || DEFAULT_DESTINATION_JAVASCRIPT
|
41
|
+
end
|
42
|
+
|
43
|
+
def javascripts
|
44
|
+
[source_javascript, destination_javascript]
|
45
|
+
end
|
46
|
+
|
47
|
+
def source_stylesheet
|
48
|
+
config_file(:source_stylesheet) || DEFAULT_SOURCE_STYLESHEET
|
49
|
+
end
|
50
|
+
|
51
|
+
def destination_stylesheet
|
52
|
+
config_file(:destination_stylesheet) || DEFAULT_DESTINATION_STYLESHEET
|
53
|
+
end
|
54
|
+
|
55
|
+
def stylesheets
|
56
|
+
[source_stylesheet, destination_stylesheet]
|
41
57
|
end
|
42
58
|
|
43
59
|
def layout
|
@@ -2,8 +2,10 @@ module SmallVictories
|
|
2
2
|
CONFIG_FILE = '_sv_config.yml'
|
3
3
|
DEFAULT_SOURCE = '_'
|
4
4
|
DEFAULT_DESTINATION = ''
|
5
|
-
|
6
|
-
|
5
|
+
DEFAULT_SOURCE_STYLESHEET = 'application.css'
|
6
|
+
DEFAULT_SOURCE_JAVASCRIPT = 'application.js'
|
7
|
+
DEFAULT_DESTINATION_STYLESHEET = '_sv_custom.css'
|
8
|
+
DEFAULT_DESTINATION_JAVASCRIPT = '_sv_custom.js'
|
7
9
|
DEFAULT_LAYOUT = '_layout.liquid'
|
8
10
|
DEFAULT_INCLUDES = '_includes'
|
9
11
|
ROOT = Dir.pwd
|
data/lib/smallvictories.rb
CHANGED
data/spec/builder_spec.rb
CHANGED
@@ -11,12 +11,12 @@ describe SmallVictories do
|
|
11
11
|
expect(File.exists?('fixtures/new/_/_layout.liquid')).to eq true
|
12
12
|
expect(File.exists?('fixtures/new/_/index.liquid')).to eq true
|
13
13
|
expect(File.exists?('fixtures/new/_/_includes/_head.liquid')).to eq true
|
14
|
-
expect(File.exists?('fixtures/new/_/
|
15
|
-
expect(File.exists?('fixtures/new/_/
|
14
|
+
expect(File.exists?('fixtures/new/_/application.js')).to eq true
|
15
|
+
expect(File.exists?('fixtures/new/_/application.css')).to eq true
|
16
16
|
end
|
17
17
|
|
18
18
|
after do
|
19
|
-
%w(fixtures/new/_sv_config.yml fixtures/new/.sv_guardfile fixtures/new/_/index.liquid fixtures/new/_/
|
19
|
+
%w(fixtures/new/_sv_config.yml fixtures/new/.sv_guardfile fixtures/new/_/index.liquid fixtures/new/_/application.css fixtures/new/_/application.js fixtures/new/_/_includes/_head.liquid fixtures/new/_/_layout.liquid).each { |path| clean_file(path) }
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
data/spec/configuration_spec.rb
CHANGED
@@ -12,12 +12,20 @@ describe SmallVictories do
|
|
12
12
|
expect(configuration.destination).to eq ''
|
13
13
|
end
|
14
14
|
|
15
|
-
it 'defaults stylesheet file' do
|
16
|
-
expect(configuration.
|
15
|
+
it 'defaults source stylesheet file' do
|
16
|
+
expect(configuration.source_stylesheet).to eq 'application.css'
|
17
17
|
end
|
18
18
|
|
19
|
-
it 'defaults
|
20
|
-
expect(configuration.
|
19
|
+
it 'defaults destination stylesheet file' do
|
20
|
+
expect(configuration.destination_stylesheet).to eq '_sv_custom.css'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'defaults source javascript file' do
|
24
|
+
expect(configuration.source_javascript).to eq 'application.js'
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'defaults destination javascript file' do
|
28
|
+
expect(configuration.destination_javascript).to eq '_sv_custom.js'
|
21
29
|
end
|
22
30
|
|
23
31
|
it 'defaults layout file' do
|
@@ -43,11 +51,11 @@ describe SmallVictories do
|
|
43
51
|
end
|
44
52
|
|
45
53
|
it 'reads the output css file' do
|
46
|
-
expect(configuration.
|
54
|
+
expect(configuration.source_stylesheet).to eq 'my-stylesheet.css'
|
47
55
|
end
|
48
56
|
|
49
57
|
it 'reads the output js file' do
|
50
|
-
expect(configuration.
|
58
|
+
expect(configuration.source_javascript).to eq 'my-javascript.js'
|
51
59
|
end
|
52
60
|
|
53
61
|
it 'reads layout file' do
|
@@ -1,6 +1,8 @@
|
|
1
1
|
source: '/my-source-folder/'
|
2
2
|
destination: 'my-site-folder/'
|
3
|
-
|
4
|
-
|
3
|
+
source_stylesheet: 'my-stylesheet.css'
|
4
|
+
source_javascript: 'my-javascript.js'
|
5
|
+
destination_stylesheet: 'stylesheet.css'
|
6
|
+
destination_javascript: 'javascript.js'
|
5
7
|
layout: '_my-template.liquid'
|
6
8
|
includes: 'snippets'
|
data/src/Guardfile
CHANGED
@@ -1,37 +1,8 @@
|
|
1
1
|
# A Small Victories Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
|
4
|
-
## Uncomment and set this to only include directories you want to watch
|
5
|
-
directories %w(.).select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
6
|
-
|
7
4
|
guard 'livereload' do
|
8
|
-
|
9
|
-
css: :css,
|
10
|
-
js: :js,
|
11
|
-
html: :html,
|
12
|
-
png: :png,
|
13
|
-
gif: :gif,
|
14
|
-
jpg: :jpg,
|
15
|
-
jpeg: :jpeg,
|
16
|
-
}
|
17
|
-
|
18
|
-
# file types LiveReload may optimize refresh for
|
19
|
-
compiled_exts = extensions.values.uniq
|
20
|
-
watch(%r{./.+\.(#{compiled_exts * '|'})})
|
21
|
-
|
22
|
-
extensions.each do |ext, type|
|
23
|
-
watch(%r{
|
24
|
-
(?:app|vendor)
|
25
|
-
(?:/assets/\w+/(?<path>[^.]+) # path+base without extension
|
26
|
-
(?<ext>\.#{ext})) # matching extension (must be first encountered)
|
27
|
-
(?:\.\w+|$) # other extensions
|
28
|
-
}x) do |m|
|
29
|
-
path = m[1]
|
30
|
-
"/_/#{path}.#{type}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
watch(%r{_/.+\.liquid})
|
5
|
+
watch(%r{.+\.(css|js|html)})
|
35
6
|
end
|
36
7
|
|
37
8
|
logger level: :warn
|
data/src/config.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smallvictories
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Dijkstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autoprefixer-rails
|
@@ -220,6 +220,10 @@ files:
|
|
220
220
|
- README.md
|
221
221
|
- Rakefile
|
222
222
|
- bin/sv
|
223
|
+
- lib/sassc/compressor.rb
|
224
|
+
- lib/sassc/functions.rb
|
225
|
+
- lib/sassc/importer.rb
|
226
|
+
- lib/sassc/template.rb
|
223
227
|
- lib/smallvictories.rb
|
224
228
|
- lib/smallvictories/builder.rb
|
225
229
|
- lib/smallvictories/compiler.rb
|
@@ -234,9 +238,8 @@ files:
|
|
234
238
|
- spec/configuration_spec.rb
|
235
239
|
- spec/fixtures/_sv_custom.css
|
236
240
|
- spec/fixtures/destination/.gitkeep
|
237
|
-
- spec/fixtures/
|
238
|
-
- spec/fixtures/
|
239
|
-
- spec/fixtures/destinationindex.html
|
241
|
+
- spec/fixtures/destination/application.css
|
242
|
+
- spec/fixtures/destination/application.js
|
240
243
|
- spec/fixtures/invalid/_layout.liquid
|
241
244
|
- spec/fixtures/invalid/_sass/stylesheet.scss
|
242
245
|
- spec/fixtures/invalid/index.html
|
@@ -248,8 +251,8 @@ files:
|
|
248
251
|
- spec/fixtures/source/_stylesheets/extra.scss
|
249
252
|
- spec/fixtures/source/_stylesheets/stylesheet.scss
|
250
253
|
- spec/fixtures/source/_sv_config.yml
|
251
|
-
- spec/fixtures/source/
|
252
|
-
- spec/fixtures/source/
|
254
|
+
- spec/fixtures/source/application.css
|
255
|
+
- spec/fixtures/source/application.js
|
253
256
|
- spec/fixtures/source/index.html
|
254
257
|
- spec/spec_helper.rb
|
255
258
|
- src/Guardfile
|
@@ -289,9 +292,8 @@ test_files:
|
|
289
292
|
- spec/configuration_spec.rb
|
290
293
|
- spec/fixtures/_sv_custom.css
|
291
294
|
- spec/fixtures/destination/.gitkeep
|
292
|
-
- spec/fixtures/
|
293
|
-
- spec/fixtures/
|
294
|
-
- spec/fixtures/destinationindex.html
|
295
|
+
- spec/fixtures/destination/application.css
|
296
|
+
- spec/fixtures/destination/application.js
|
295
297
|
- spec/fixtures/invalid/_layout.liquid
|
296
298
|
- spec/fixtures/invalid/_sass/stylesheet.scss
|
297
299
|
- spec/fixtures/invalid/index.html
|
@@ -303,7 +305,7 @@ test_files:
|
|
303
305
|
- spec/fixtures/source/_stylesheets/extra.scss
|
304
306
|
- spec/fixtures/source/_stylesheets/stylesheet.scss
|
305
307
|
- spec/fixtures/source/_sv_config.yml
|
306
|
-
- spec/fixtures/source/
|
307
|
-
- spec/fixtures/source/
|
308
|
+
- spec/fixtures/source/application.css
|
309
|
+
- spec/fixtures/source/application.js
|
308
310
|
- spec/fixtures/source/index.html
|
309
311
|
- spec/spec_helper.rb
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|