Skip to content

Commit

Permalink
Merge pull request #128 from zmbush/allow-underscored-yml
Browse files Browse the repository at this point in the history
Allow using _autoprefixer.yml to configure autoprefixer
  • Loading branch information
ixti committed Mar 3, 2015
2 parents 6d84d40 + ecd7897 commit e01a9e6
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions lib/jekyll/assets_plugin/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,28 @@ def find_asset(path, *args)

private

def browsers
file = Pathname.new(@site.source).join "autoprefixer.yml"
opts = {}
params = file.exist? ? YAML.load_file(file) : {}
params = params.reduce({}) do |h, (key, value)|
def load_autoprefixer_yml(files)
params = {}

files.each do |file|
f = Pathname.new(@site.source).join file
if f.exist?
params = YAML.load_file(f)
break
end
end

params.reduce({}) do |h, (key, value)|
h.update(key.to_sym => value)
end
end

def browsers
opts = {}
params = load_autoprefixer_yml([
"autoprefixer.yml",
"_autoprefixer.yml"
])

opts[:safe] = true if params.delete(:safe)
[params, opts]
Expand Down

0 comments on commit e01a9e6

Please sign in to comment.