Skip to content

Ignore underscored files when compiling a directory. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def compile_dirname(
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
for dirpath, _, filenames in os.walk(search_path):
filenames = [
filename for filename in filenames if filename.endswith('.scss')
filename for filename in filenames
if filename.endswith('.scss') and not filename.startswith('_')
]
for filename in filenames:
input_filename = os.path.join(dirpath, filename)
Expand Down
12 changes: 11 additions & 1 deletion sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ def test_successful(self):
# Make sure we don't compile non-scss files
write_file(os.path.join(input_dir, 'baz.txt'), 'Hello der')

# the api for this is weird, why does it need source?
sass.compile(dirname=(input_dir, output_dir))
assert os.path.exists(output_dir)
assert os.path.exists(os.path.join(output_dir, 'foo'))
Expand All @@ -711,6 +710,17 @@ def test_successful(self):
self.assertEqual(contentsf1, 'a b {\n width: 100%; }\n')
self.assertEqual(contentsf2, 'foo {\n width: 100%; }\n')

def test_ignores_underscored_files(self):
with tempdir() as tmpdir:
input_dir = os.path.join(tmpdir, 'input')
output_dir = os.path.join(tmpdir, 'output')
os.mkdir(input_dir)
write_file(os.path.join(input_dir, 'f1.scss'), '@import "f2";')
write_file(os.path.join(input_dir, '_f2.scss'), 'a{color:red}')

sass.compile(dirname=(input_dir, output_dir))
assert not os.path.exists(os.path.join(output_dir, '_f2.css'))

def test_error(self):
with tempdir() as tmpdir:
input_dir = os.path.join(tmpdir, 'input')
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy