Store list of expected extnames in a constant (#7638)

Merge pull request 7638
This commit is contained in:
Ashwin Maroli 2019-05-02 00:24:18 +05:30 committed by jekyllbot
parent 568e50b37a
commit b04e3d3de7
2 changed files with 6 additions and 3 deletions

View File

@ -146,7 +146,7 @@ module Jekyll
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w(.sass .scss).include?(ext)
Jekyll::Document::SASS_FILE_EXTS.include?(ext)
end
# Determine whether the document is a CoffeeScript file.

View File

@ -14,6 +14,9 @@ module Jekyll
DATELESS_FILENAME_MATCHER = %r!^(?:.+/)*(.*)(\.[^.]+)$!.freeze
DATE_FILENAME_MATCHER = %r!^(?>.+/)*?(\d{2,4}-\d{1,2}-\d{1,2})-([^/]*)(\.[^.]+)$!.freeze
SASS_FILE_EXTS = %w(.sass .scss).freeze
YAML_FILE_EXTS = %w(.yaml .yml).freeze
# Create a new Document.
#
# path - the path to the file
@ -138,7 +141,7 @@ module Jekyll
#
# Returns true if the extname is either .yml or .yaml, false otherwise.
def yaml_file?
%w(.yaml .yml).include?(extname)
YAML_FILE_EXTS.include?(extname)
end
# Determine whether the document is an asset file.
@ -154,7 +157,7 @@ module Jekyll
#
# Returns true if extname == .sass or .scss, false otherwise.
def sass_file?
%w(.sass .scss).include?(extname)
SASS_FILE_EXTS.include?(extname)
end
# Determine whether the document is a CoffeeScript file.