Created
May 21, 2017 12:02
-
-
Save rmhsilva/425113f9ba820b25c33c28202715a849 to your computer and use it in GitHub Desktop.
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
;;;; Dreaming of writing Vue frontends in a lispy way. | |
(defmacro defcomponent (name (&rest imports) &key template data style)) | |
;; Goal: | |
;; Replicate http://vue-loader.vuejs.org/en/start/spec.html in CL | |
(defcomponent hello () | |
:template (with-html | |
(:p "Hello {{ person }}!")) | |
:data (lambda () (create ...)) | |
:style '()) | |
;; use LASS for css | |
#| | |
The above should register the relevant html, js and css in a data structure | |
somewhere. | |
The HTML -> <template> tags | |
The JS & CSS -> grouped into a single uri (eg css/components/hello.css) | |
We can define a bunch of small 'components' in this way | |
Goal: generate a bunch of calls to Vue.component with the name, template and | |
script. | |
Note: there also needs to be a way to pack all the components up for production. | |
In my head, web development is one big harmonious endeavour, backend and | |
frontend all written in lisp, no complicated packaging, etc. | |
Files | |
------ | |
/js/components.js => components compiled into js objects | |
/css/components.css => all component css | |
In dev these are regenerated + cached as required. Before production they are | |
written to disk once and minified. | |
|# | |
(defun get-js (&rest components)) | |
(defun get-css (&rest components)) | |
#| | |
There is one obvious limitation here -- when building components, the script | |
definitions will never be run in a CommonJS environment, so we cannot use | |
Imports and similar to manage dependencies. | |
There is probably a good way of handling this though... | |
|# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment