-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/josephmancuso/masonite-core
- Loading branch information
Showing
4 changed files
with
27 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
docs | ||
masonite.egg-info | ||
venv | ||
venv | ||
.vscode |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,32 @@ | ||
from config import storage, application | ||
import os | ||
import sass | ||
|
||
class Storage(object): | ||
|
||
def __init__(self): | ||
pass | ||
|
||
# this function will compile sass files only if the libsass module installed | ||
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) |