Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
79c76935
Commit
79c76935
authored
May 02, 2017
by
Sli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add simple way to compile scss files
parent
b23d322a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
3 deletions
+75
-3
README.md
README.md
+2
-2
core/management/commands/compilestatic.py
core/management/commands/compilestatic.py
+72
-0
sith/settings.py
sith/settings.py
+1
-1
No files found.
README.md
View file @
79c76935
...
...
@@ -36,8 +36,8 @@ The development is done with sqlite, but it is advised to set a more robust DBMS
### Collecting statics for production:
```
./manage.py collectstatic
--ignore=.scss
./manage.py compiles
css
./manage.py collectstatic
./manage.py compiles
tatic
```
### Misc about development
...
...
core/management/commands/compilestatic.py
0 → 100644
View file @
79c76935
#!/usr/bin/env python3
# -*- coding:utf-8 -*
#
# Copyright 2016,2017
# - Sli <antoine@bartuccio.fr>
#
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
# http://ae.utbm.fr.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License a published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Sofware Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
import
os
import
sass
from
django.core.management.base
import
BaseCommand
class
Command
(
BaseCommand
):
help
=
"Comile scss files from static folder"
def
compilescss
(
self
,
folder
):
to_compile
=
[]
for
file
in
os
.
listdir
(
folder
):
file
=
os
.
path
.
join
(
folder
,
file
)
if
os
.
path
.
isdir
(
file
):
self
.
compilescss
(
file
)
else
:
path
,
ext
=
os
.
path
.
splitext
(
file
)
if
ext
==
".scss"
:
to_compile
.
append
(
file
)
for
f
in
to_compile
:
print
(
"compilling %s"
%
f
)
with
open
(
f
,
"r"
)
as
oldfile
:
with
open
(
f
.
replace
(
'.scss'
,
'.css'
),
"w"
)
as
newfile
:
newfile
.
write
(
sass
.
compile
(
string
=
oldfile
.
read
()))
def
removescss
(
self
,
folder
):
to_remove
=
[]
for
file
in
os
.
listdir
(
folder
):
file
=
os
.
path
.
join
(
folder
,
file
)
if
os
.
path
.
isdir
(
file
):
self
.
removescss
(
file
)
else
:
path
,
ext
=
os
.
path
.
splitext
(
file
)
if
ext
==
".scss"
:
to_remove
.
append
(
file
)
for
f
in
to_remove
:
print
(
"removing %s"
%
f
)
os
.
remove
(
f
)
def
handle
(
self
,
*
args
,
**
options
):
if
'static'
in
os
.
listdir
():
print
(
"---- Compilling scss files ---"
)
self
.
compilescss
(
'static'
)
print
(
"---- Removing scss files ----"
)
self
.
removescss
(
'static'
)
else
:
print
(
"No static folder avaliable, please use collectstatic before compilling scss"
)
\ No newline at end of file
sith/settings.py
View file @
79c76935
...
...
@@ -188,7 +188,7 @@ SASS_PRECISION = 8
SASS_OUTPUT_STYLE
=
'compact'
SASS_TEMPLATE_EXTS
=
[
'.
html'
,
'.
jinja'
]
SASS_TEMPLATE_EXTS
=
[
'.jinja'
]
WSGI_APPLICATION
=
'sith.wsgi.application'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment