-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjquery-seq-debug-macros.lisp
37 lines (34 loc) · 1.7 KB
/
jquery-seq-debug-macros.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(in-package :weblocks-utils)
(ps:defpsmacro ps-with-scripts ((&rest scripts) &body body)
"Wrapper around jQuery-seq withScripts,
fixes scripts paths with `prepend-webapp-path` and calls withScripts"
`(let ((args (ps:LISP
(list* 'make-array
(loop for i in (list ,@scripts) collect
(if (ignore-errors (current-webapp))
(weblocks-utils:prepend-webapp-path i)
i))))))
((ps:@ args push) (lambda () ,@body))
(apply with-scripts args)))
(ps:defpsmacro ps-with-styles ((&rest styles)
&body body)
"Wrapper around jQuery-seq withStyles,
fixes styles paths with `prepend-webapp-path` and calls withStyles"
`(let ((args (ps:LISP
(list* 'make-array
(loop for i in (list ,@styles) collect
(if (ignore-errors (current-webapp))
(weblocks-utils:prepend-webapp-path i)
i))))))
((ps:@ args push) (lambda () ,@body))
(apply with-styles args)))
(ps:defpsmacro ps-with-scripts-and-styles
((&rest scripts) (&rest styles) &body body)
"Wrapper around jQuery-seq withStyles and withScripts,
fixes scripts paths and styles paths with `prepend-webapp-path`
and calls withScripts first and withStyles inside of withScripts call"
`(ps-with-scripts ,scripts
,(if styles
`(ps-with-styles ,styles
,@body)
body)))