Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webcache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
webcache
Commits
a09d7dcb
Commit
a09d7dcb
authored
Feb 11, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented cache/minify controllers for JavaScript/CSS.
parent
3384abc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
6 deletions
+36
-6
controllers.py
controllers.py
+36
-6
No files found.
controllers.py
View file @
a09d7dcb
import
slimit
import
cssmin
from
importer
import
Importer
class
JsCache
(
Importer
):
class
CacheController
:
__cached__
=
'cached/'
__aliases__
=
{}
def
GET
(
self
,
files
):
cache
=
Importer
(
extension
=
self
.
__extension__
,
root
=
self
.
__root__
,
cached
=
self
.
__cached__
)
for
alias
,
path
in
self
.
__aliases__
.
iteritems
():
cache
.
set_alias
(
alias
,
path
)
for
f
in
files
.
split
(
','
):
cache
.
add
(
f
)
output
=
cache
.
output
()
if
hasattr
(
self
,
'minify'
):
output
=
self
.
minify
(
output
)
return
output
class
JsCache
(
CacheController
):
__url__
=
'/js/(.*)'
__root__
=
'static/js/'
__extension__
=
'js'
def
__init__
(
self
,
roo
t
):
Importer
.
__init__
(
self
,
root
=
root
,
extension
=
'js'
)
def
minify
(
self
,
outpu
t
):
return
slimit
.
minify
(
output
)
class
CssCache
(
Import
er
):
class
CssCache
(
CacheControll
er
):
__url__
=
'/css/(.*)'
__root__
=
'static/css/'
__extension__
=
'css'
def
__init__
(
self
,
roo
t
):
Importer
.
__init__
(
self
,
root
=
root
,
extension
=
'css'
)
def
minify
(
self
,
outpu
t
):
return
cssmin
.
cssmin
(
output
)
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