From 54ee71c52d1c30922f86067470c2b72a1c901fb3 Mon Sep 17 00:00:00 2001 From: Joseph Mancuso Date: Wed, 10 Jan 2018 08:47:25 -0500 Subject: [PATCH 1/5] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7084ba24a..4be7ff4c0 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# LaraPy +# Masonite Core files for the python framework + +To get started with this repo, [read the CONTRIBUTING.md file on the masonite repo](https://github.com/josephmancuso/masonite/blob/master/CONTRIBUTING.md) From 28bebffcdc5eea73d24cdfa6effbaf3463e016a4 Mon Sep 17 00:00:00 2001 From: Afdol Rizki Date: Thu, 11 Jan 2018 13:50:03 +0700 Subject: [PATCH 2/5] put try catch block when import sass module --- masonite/storage.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/masonite/storage.py b/masonite/storage.py index f5e620346..a65ac1273 100644 --- a/masonite/storage.py +++ b/masonite/storage.py @@ -1,6 +1,5 @@ from config import storage, application import os -import sass class Storage(object): @@ -8,20 +7,25 @@ def __init__(self): pass def compile_sass(self): - matches = [] - for files in storage.SASSFILES['importFrom']: - for root, dirnames, filenames in os.walk(os.path.join(application.BASE_DIRECTORY, files)): - for filename in filenames: - if filename.endswith(('.sass', '.scss')) and not filename.startswith('_'): - matches.append(os.path.join(root, filename)) + try: + import sass + except ImportError as e: + pass + else: + matches = [] + for files in storage.SASSFILES['importFrom']: + for root, dirnames, filenames in os.walk(os.path.join(application.BASE_DIRECTORY, files)): + for filename in filenames: + if filename.endswith(('.sass', '.scss')) and not filename.startswith('_'): + matches.append(os.path.join(root, filename)) - for filename in matches: - with open(filename) as f: - compiled_sass = sass.compile( - string=f.read(), include_paths=storage.SASSFILES['includePaths'] - ) - name = filename.split(os.sep)[-1].replace('.scss', '').replace('.sass', '') - write_file = os.path.join(os.path.join(application.BASE_DIRECTORY, - storage.SASSFILES['compileTo']), '{0}.css'.format(name)) - with open(write_file, 'w') as r: - r.write(compiled_sass) + for filename in matches: + with open(filename) as f: + compiled_sass = sass.compile( + string=f.read(), include_paths=storage.SASSFILES['includePaths'] + ) + name = filename.split(os.sep)[-1].replace('.scss', '').replace('.sass', '') + write_file = os.path.join(os.path.join(application.BASE_DIRECTORY, + storage.SASSFILES['compileTo']), '{0}.css'.format(name)) + with open(write_file, 'w') as r: + r.write(compiled_sass) From ecebc26c68dab6be022a777294064c0c1ab31e61 Mon Sep 17 00:00:00 2001 From: Afdol Rizki Date: Thu, 11 Jan 2018 13:50:50 +0700 Subject: [PATCH 3/5] remove vscode folder --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c8d8f5921..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "${workspaceFolder}/venv/bin/python" -} \ No newline at end of file From 0c4091878ee757bd57ef66740b06a81275706718 Mon Sep 17 00:00:00 2001 From: Afdol Rizki Date: Thu, 11 Jan 2018 14:06:24 +0700 Subject: [PATCH 4/5] add vscode folder to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3bb41eed3..4121c4f75 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ dist docs masonite.egg-info -venv \ No newline at end of file +venv +.vscode \ No newline at end of file From d24c82a4a6b333477ebcf1cd1c4d2c7550541430 Mon Sep 17 00:00:00 2001 From: Afdol Rizki Date: Thu, 11 Jan 2018 14:06:46 +0700 Subject: [PATCH 5/5] add comment to compile_sass function --- masonite/storage.py | 1 + 1 file changed, 1 insertion(+) diff --git a/masonite/storage.py b/masonite/storage.py index a65ac1273..677c868a6 100644 --- a/masonite/storage.py +++ b/masonite/storage.py @@ -6,6 +6,7 @@ class Storage(object): def __init__(self): pass + # this function will compile sass files only if the libsass module installed def compile_sass(self): try: import sass