Meteor code generator

3000 views
Skip to first unread message

Petar Korponaić

unread,
Aug 4, 2014, 2:51:22 PM8/4/14
to meteo...@googlegroups.com
Hi guys!

I started this project - it's meteor application generator: http://www.meteorkitchen.com

Maybe can be useful to someone. It's in early stage but it already saves me from a lot of boring and repeating code. Currently I am using it to start a new meteor application.

Please let me know what do you think? I plan to continue on this project if you find it useful and interesting.

Cheers!
Petar

P.S. site is meteor application created with generator without writing a single line of code. :)

Petar Korponaić

unread,
Aug 4, 2014, 3:12:07 PM8/4/14
to meteo...@googlegroups.com

James Wilson

unread,
Aug 4, 2014, 3:48:14 PM8/4/14
to meteo...@googlegroups.com
Great work man!

Very cool. Good job!

James Wilson


--
You received this message because you are subscribed to the Google Groups "meteor-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meteor-talk...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maxime Quandalle

unread,
Aug 4, 2014, 7:29:50 PM8/4/14
to meteo...@googlegroups.com
Hi Petar,

For a single line installation like the one you propose:

> curl http://www.meteorkitchen.com/install | /bin/sh #

You should really use SSL, I don't want to execute some middle man code on my machine!

Otherwise, this generator is something new to me. Does that exists for other frameworks? Rails? Django?
Do you expect developers to write the JSON files [0] or maybe we can imagine an app with some UI (in the browser, or in the command line) to generate this file for the dev?
How does that compare to em [1]?

Maxime

[0]: https://github.com/perak/kitchen-site/blob/master/meteor-kitchen.json
[1]: https://github.com/EventedMind/em

Petar Korponaić

unread,
Aug 5, 2014, 12:46:12 AM8/5/14
to meteo...@googlegroups.com, Ja...@jameswilson.name
Thank you James! :)

Petar Korponaić

unread,
Aug 5, 2014, 1:10:38 AM8/5/14
to meteo...@googlegroups.com
Hi Maxime,

Thank you for review!

1. I'l switch to SSL soon.

2. It doesn't exists for other frameworks, I made it specifically for meteor.

3. Manually writing input JSON file can be difficult but it's still much faster than writing resulting application code. In "getting started" I wrote that GUI is under construction; In fact, I paused work on GUI because I need to make quality CLI first (currently I am working on better user account system and improving built-in components (form, dataview etc.).

4. "em" is cool: my tool currently cannot be used to add something later into application (when executed, it overwrites existing files), but "meteor-kitchen" can produce page contents (as you can see in examples), and developer can make own page content components (plugins). Main idea behind "meteor-kitchen" is to build as much code as possible in the beginning.

Deivide Oliveira

unread,
Aug 5, 2014, 11:18:00 AM8/5/14
to meteo...@googlegroups.com
Excellent!! 

Thank you very much!! 

Cheers! 

Deivide

Maxime Quandalle

unread,
Aug 5, 2014, 11:33:02 AM8/5/14
to meteo...@googlegroups.com
Also, do you plan to open the source code?


Le lundi 4 août 2014 20:51:22 UTC+2, Petar Korponaić a écrit :

Vijay Tailor

unread,
Aug 6, 2014, 10:08:09 AM8/6/14
to meteo...@googlegroups.com
Wow, very impressive. I wouldn't count on Meteorite at the moment though and build my own solution + would definitely invest in GUI or at least a wizard. Something like http://generatewp.com/ maybe?

Cheers,
Tailor

בתאריך יום שני, 4 באוגוסט 2014 21:51:22 UTC+3, מאת Petar Korponaić:

Petar Korponaić

unread,
Aug 6, 2014, 10:18:47 AM8/6/14
to meteo...@googlegroups.com
Thanks Deivide!

Petar Korponaić

unread,
Aug 6, 2014, 10:25:34 AM8/6/14
to meteo...@googlegroups.com
When I start making "meteor-kitchen", I did it to help myself, but then I decide to share it and see how people reacts - does meteor generator makes any sense or not. 

Currently, I am not sure what to do and what model to choose. For now, source code is closed. 

What do you think about that?

Petar Korponaić

unread,
Aug 6, 2014, 10:54:49 AM8/6/14
to meteo...@googlegroups.com
Hey Tailor!

Yeah, GUI is definitely on my list. Thank you for your suggestions. I already have some vision on how it should look like. In fact, It's 3rd application generator that I made: the first one in 2001-2002, it is windows application generator with GUI, it served in my ex. company for 10+ years and is "in house" development tool never commercialized/published. 

However, any idea is welcome. 

Also, GUI can be separate tool from CLI/generator core - GUI should produce JSON file which is input for generator. I am ready to help if someone have time and wish to work on that project.

Cheers,
Petar :)

Pahan Sarathchandra

unread,
Aug 6, 2014, 11:56:06 AM8/6/14
to meteor-talk
looking good. does dataview feature support pagination?


--
You received this message because you are subscribed to the Google Groups "meteor-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to meteor-talk...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--pahans

Petar Korponaić

unread,
Aug 6, 2014, 2:37:06 PM8/6/14
to meteo...@googlegroups.com
Hi Pahan,

DataView component currently doesn't support pagination for large datasets. 

For all feature requests feel free to open github issue here: https://github.com/perak/kitchen-site/issues

Also, take in account that you can create your own component (plugin) for generator. Plugin documentation is thin, but I'l expand it when I find some free time (you can open issue for that too).

Thank you!
:) 

Steve Heady

unread,
Aug 10, 2014, 2:48:36 PM8/10/14
to meteo...@googlegroups.com
Hi Peter,

Thanks for putting this together, tested it out with a few examples and have a couple points of feedback:

1.  The directory structure is somewhat unconventional.

/both
  /router/router.js
  /collections/name.js

/lib
  (empty)

As opposed to the standard directory structure:

/lib
  router.js
/collections
  name.js

In general a lot of empty folders to sift through for a streamlined process

2.  Some of the types aren't fully defined.  

"type": "boolean" crashes on the error:  

Field source element "#form-input-checkbox" not found.

Unclear how to create array objects within collections.  The simpleSchema way isn't compatible:
{ "name":"stat","type":"object" }
{ "name":"stat.$.value" }
{ "name":"stat.$.description"}

3. The object reference page would be more useful if it listed available options for each paramater.  Right now most of them list the default but aren't clear what values are accepted.

Overall, its a departure from the process I'd use to create a project, but see plenty of potential in meteor-kitchen.  I'd also look into dropping the JSON creator into a webform to expose options and make setup easier.

-Steve

Petar Korponaić

unread,
Aug 10, 2014, 3:55:15 PM8/10/14
to meteo...@googlegroups.com
Hi Steve,

Thank you for detailed review!

Answers to your questions:

1. Directory structure is somewhat unconventional. I plan to modify it to be compatible with "em" scaffolding tool: https://github.com/EventedMind/em


2. Form component is not fully finished yet: it currently supports only "read_only", "text" and "textarea" input fields (I see form error message that your form have "checkbox" input field). 

Other form inputs will be added soon. Also, you can modify form template in directory where meteor-kitchen is installed, by default it is in "~/.meteor-kitchen/templates/bootstrap/form.html" - you can add <div id="form-input-checkbox"... but note: that will be overwritten when you install new version.


3. Object reference is automatically generated from source code & code comments. That will be changed - new version of generator (I didn't uploaded it yet) can export metadata information about each object with default values and possible options for each property. That metadata will be used for kitchen-GUI and for documentation generator. Currently I am really busy with other things, but I plan to generate kitchen-GUI with meteor-kitchen itself by using metadata info.

Stay tuned! :)

Cheers,
Petar

Gabriel Pugliese

unread,
Aug 10, 2014, 8:34:06 PM8/10/14
to meteo...@googlegroups.com
Hey guys, for 1) check my issue https://github.com/EventedMind/em/issues/29



Gabriel Pugliese
CodersTV.com
@coderstv

Serkan Durusoy

unread,
Aug 11, 2014, 7:34:33 AM8/11/14
to meteo...@googlegroups.com
Wow!

"Files in subdirectories are loaded before files in parent directories, so that files in the deepest subdirectory are loaded first, and files in the root directory are loaded last."

from the official docs is then soooo misleading!.. Well, to be fair, semantically debatable...

Phuc Nguyen

unread,
Aug 11, 2014, 9:27:38 AM8/11/14
to meteo...@googlegroups.com
This is very awesome :D !!!

Gabriel Pugliese

unread,
Aug 11, 2014, 3:37:58 PM8/11/14
to meteo...@googlegroups.com
@Serkan,

The docs are not wrong, look at the third bullet:
  • After sorting as described above, all files under directories named lib are moved before everything else (preserving their order).


I've done another test and I think putting simply on lib/both/ is not enough. Look at this:


  <script type="text/javascript" src="/client/lib/test.js?2a3453bba5b8f7e5a39caf4f0fb6016f1b588104"></script>
  <script type="text/javascript" src="/lib/both/test.js?2a3453bba5b8f7e5a39caf4f0fb6016f1b588104"></script>
  <script type="text/javascript" src="/lib/test.js?2a3453bba5b8f7e5a39caf4f0fb6016f1b588104"></script>
  <script type="text/javascript" src="/project.js?452b723531a416610206cc10bcbb81ffec4d33e1"></script>

client/lib is still loaded first. If something inside that folder depends on something at lib/both/ it will not work :(




Gabriel Pugliese
CodersTV.com
@coderstv


Serkan Durusoy

unread,
Aug 11, 2014, 3:44:13 PM8/11/14
to meteo...@googlegroups.com
Hmm, even more confusing, but what I'm baffled at is actually line 122 of your screenshot https://camo.githubusercontent.com/330b16ec2dabb249bd3a85f0fda66f3986562a1d/687474703a2f2f692e696d6775722e636f6d2f673855337471762e706e67

This looks counter-intuitive at best.

Petar Korponaić

unread,
Aug 11, 2014, 3:46:11 PM8/11/14
to meteo...@googlegroups.com
Thank you Phuc! ;)

Gabriel Pugliese

unread,
Aug 11, 2014, 4:18:28 PM8/11/14
to meteo...@googlegroups.com
That's because client/views/private/ has more deeper than both/collections/ (3x2)

Sorry for polluting your thread @Petar :(



Gabriel Pugliese
CodersTV.com
@coderstv


Petar Korponaić

unread,
Aug 11, 2014, 4:20:56 PM8/11/14
to meteo...@googlegroups.com
No problem :)

Tom Huges

unread,
Aug 11, 2014, 8:39:36 PM8/11/14
to meteo...@googlegroups.com
Thanks Petar! Very helpful for somebody like me who's starting out with Meteor.

Petar Korponaić

unread,
Aug 13, 2014, 7:08:21 AM8/13/14
to meteo...@googlegroups.com
Thanks Tom! :)

Also, instead of manually typing JSON input file, you can expect kitchen-GUI soon (next week), so... stay tuned! ;) 

Cheers!
Petar

Ali Camarata

unread,
Aug 13, 2014, 9:35:35 AM8/13/14
to Meteor Talk
What's the github repo so we can contribute and post issues via github?


Petar Korponaić

unread,
Aug 13, 2014, 11:57:44 AM8/13/14
to meteo...@googlegroups.com
Hi Ali,


But... code is not open (yet)

I am working on GUI and I improved plugin support in new version (not uploaded yet). Also, there will be public repository for plugins so anyone will be able to contribute by writing plugins. 

Also, any issues reported are welcome!

Thank you! :) 

Petar Korponaić

unread,
Aug 20, 2014, 7:07:12 AM8/20/14
to meteo...@googlegroups.com
Hi everybody,

I just uploaded new version of meteor-kitchen, just run install again to upgrade.

What's new:

- CoffeeScript: if you add "--coffee" switch, generator will produce .coffee code instead of .js (you need to install "js2coffee" npm module to do that).

- Metadata: generator can extract metadata info (JSON describing input file structure). I don't know would it be useful to someone - I am using it in kitchen-GUI.

- Examples are built-in, with --example switch you can build 5 example apps (type "meteor-kitchen --help" for more info).


I am still working on GUI, stay tuned!

:)

Dirk Stevens

unread,
Aug 20, 2014, 1:30:23 PM8/20/14
to meteo...@googlegroups.com

Cool stuff Petar - looks great to get started !

Petar Korponaić

unread,
Aug 22, 2014, 3:48:54 AM8/22/14
to meteo...@googlegroups.com
Thank you Dirk! :)

Petar Korponaić

unread,
Aug 22, 2014, 3:53:57 AM8/22/14
to meteo...@googlegroups.com
Good news for Jade lovers: use --jade switch and generator will convert html files to jade.

Jade converter is experimental (I wrote it in rush). It's not 100% syntactically clean and will be improved in future. At least, it's super fast (long live good old friend: C++).

Enjoy! (and share your impressions).

吕世博

unread,
Aug 22, 2014, 7:44:46 AM8/22/14
to meteo...@googlegroups.com
I think it's necessary to allow registered users visit pages in public zone(Most websites did this right?), and there are a few points I complained when I was building an app:
1. Should we have a i18n support of the login/register page and form controls? Or allow developers modify the strings.
2.Why do you choose navbar-inverse instead of default? It's really ugly, I think you can provide an option to let developer choose the one they love.
3.It's stupid to write all the "code" into one son file. Could we have some ways to "include" a json file? Or just auto-link all the files in the source folder, just like meteor.

在 2014年8月5日星期二UTC+8上午2时51分22秒,Petar Korponaić写道:

David Collier

unread,
Aug 22, 2014, 1:09:01 PM8/22/14
to meteo...@googlegroups.com
This is very cool! There's a whole world of SSGs (static site generators) out there, but you just made it as easy to generate a live site!

you might want to think about YAML rather than JSON as it's a lot easier / less error-prone to write by hand.

it's impressive you wrote your own C++ Jade converter! There's also this related project from Denis G  https://github.com/DenisGorbachev/priest

Petar Korponaić

unread,
Aug 23, 2014, 2:19:57 AM8/23/14
to meteo...@googlegroups.com

Thank you for review!

1. Login/Register page will be improved in future. However, you can do it yourself: go to meteor-kitchen templates directory, typically it is in: ~/.meteor-kitchen/templates/bootstrap/ and find login.html/login.js, register.html/register.js etc. Make renamed copies of these files and modify them. Than you can do in your input file:

...
{ "name": "login", "template": "your_version_of_login.html" },
{ "name": "register", "template": "your_version_of_register.html" },
{ "name": "forgot_password", "template": "your_version_of_forgot_password.html" },
{ "name": "reset_password", "template": "your_version_of_reset_password.html" }
...


2. You are right: layout is currently fixed and should be improved. You can do it yourself, template files are:

~/.meteor-kitchen/templates/bootstrap/layout_simple.html
~/.meteor-kitchen/templates/bootstrap/layout_accounts.html

Note: when you install new version of meteor-kitchen, these files will be overwritten (!)


3. Single JSON file that you wrote produces 1000's lines of js & html code. How many code you want to write to produce dynamic site? :D BTW, take into account that I am working on GUI: once I finish - no more writing json files.


Cheers!
Petar   

Petar Korponaić

unread,
Aug 23, 2014, 2:32:30 AM8/23/14
to meteo...@googlegroups.com
Thank you David!

YAML/JSON: I am currently working on a kitchen-GUI. Once I finish - no more need to manually write JSON (or any other type of) input file. So, stay tuned! :)

Cheers!
Petar

吕世博

unread,
Aug 27, 2014, 1:23:49 AM8/27/14
to meteo...@googlegroups.com
Thank you. And are you ready for Meteor 0.9? Still, I think it's necessary to allow registered users visit pages in public zone.

在 2014年8月23日星期六UTC+8下午2时19分57秒,Petar Korponaić写道:

Petar Korponaić

unread,
Aug 27, 2014, 3:27:58 AM8/27/14
to meteo...@googlegroups.com

Meteor Kitchen is ready for 0.9.0, but some packages used by built-in components are not compatible with new packaging system yet. So, I temporary modified newest version of meteor-kitchen to forcibly use meteor 0.8.3 (it executes "meteor create project_name --release 0.8.3"), I will wait few days to see what will happen, currently there is real mess with packages.

About pages in public zone: I added issue to github page https://github.com/perak/kitchen-site/issues/13

Feel free to report issues here: https://github.com/perak/kitchen-site/issues 

Thanks!
Petar

Vijay Tailor

unread,
Sep 11, 2014, 12:02:24 PM9/11/14
to meteo...@googlegroups.com
Hi Peter, any updates on Meteor Kitchen and Meteor 0.9.0/1?

Kind regards,
Tailor Vijay

בתאריך יום רביעי, 27 באוגוסט 2014 10:27:58 UTC+3, מאת Petar Korponaić:

Rafiki Cai

unread,
Sep 11, 2014, 12:05:11 PM9/11/14
to meteo...@googlegroups.com
Vijay:

I trust that all is well w/ Petar.  He's been clean off
the radar for a while now.

RC

Petar Korponaić

unread,
Sep 12, 2014, 1:46:43 AM9/12/14
to meteo...@googlegroups.com
Hi guys!

I am alive! :) But... busy these days. I uploaded new version yesterday: it is related to user roles and collection hooks, but no docs yet (except "object reference"). I will update docs soon (getting started page).

I didn't focused on 0.9+ yet. I believe that mess around meteor packages is now mostly fixed, so my next step (when I find some time) will be to make kitchen work with new package system.

P.S. let me know what for / how are you using meteor-kitchen? (Just curious) :)

Cheers!
Petar

Marco Wettstein

unread,
Sep 12, 2014, 4:49:41 AM9/12/14
to meteo...@googlegroups.com
oh, that's so cool! thank you very much!

Petar Korponaić

unread,
Sep 15, 2014, 2:26:23 AM9/15/14
to meteo...@googlegroups.com
Hey Vijay,

Kitchen now works with Meteor >=0.9 (and doesn't work with <0.9 anymore). 

Just update it (install kitchen again).

Cheers!


On Thursday, September 11, 2014 6:02:24 PM UTC+2, Vijay Tailor wrote:

Petar Korponaić

unread,
Sep 15, 2014, 2:44:33 AM9/15/14
to meteo...@googlegroups.com
Hello everybody!

"Meteor Kitchen" now works with Meteor 0.9+ (and be careful - it doesn't work with old versions anymore).

Other news:

User roles

You can now define user roles, and restrict any page to any set of user roles. Also, access to collections can be restricted: collection definition now has properties "roles_allowed_to_read", "roles_allowed_to_insert", "roles_allowed_to_update" and "roles_allowed_to_delete". No docs and examples yet (only docs about roles is in "object reference" page).

Form

Built-in form component now supports more input controls (added: checkbox, radio and select). Also, input type "select" can show options from collection (lookup_query).

Fixed some bugs

I fixed bunch of minor bugs.


Enjoy!

On Monday, August 4, 2014 8:51:22 PM UTC+2, Petar Korponaić wrote:

Petar Korponaić

unread,
Sep 15, 2014, 4:32:42 AM9/15/14
to meteo...@googlegroups.com
Update: added guide about user roles into "Getting started" page.

Jan S

unread,
Sep 25, 2014, 11:13:40 AM9/25/14
to meteo...@googlegroups.com
latitudee5400@Latitude-E5400-PC:~$ curl http://www.meteorkitchen.com/install | /bin/sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2187    0  2187    0     0   2795      0 --:--:-- --:--:-- --:--:--  3521
Installing "Meteor Kitchen" - Meteor application code generator
Detecting OS...
Detected OS: Linux
Downloading distribution...
######################################################################## 100,0%
Creating destination directory...
Unpacking...
Cleaning up...
rm: cannot remove `/home/latitudee5400/.meteor-kitchen/examples/example-*.json': No such file or directory
Done.

"Meteor kitchen" is now installed in "/home/latitudee5400/.meteor-kitchen".

Creating symlink: ln -s /home/latitudee5400/.meteor-kitchen/bin/meteor-kitchen /usr/local/bin/meteor-kitchen
Done.

Now you can launch generator by typing:

    meteor-kitchen

For more info visit: www.meteorkitchen.com
Enjoy!
latitudee5400@Latitude-E5400-PC:~$ meteor-kitchen
bash: /usr/local/bin/meteor-kitchen: cannot execute binary file
latitudee5400@Latitude-E5400-PC:~$ sudo meteor-kitchen
/usr/local/bin/meteor-kitchen: 1: /usr/local/bin/meteor-kitchen: Syntax error: "(" unexpected

 
can't get meteor-kitchen working on my machine :( anyone else experiencing issues?

by the way great project - keep up the good work!

 

Petar Korponaić

unread,
Sep 25, 2014, 11:22:00 AM9/25/14
to meteo...@googlegroups.com
Hi Jan,

What operating system are you using?

Petar Korponaić

unread,
Sep 25, 2014, 11:22:39 AM9/25/14
to meteo...@googlegroups.com
(which linux distribution to be more precise)

Jan S

unread,
Sep 25, 2014, 3:19:04 PM9/25/14
to meteo...@googlegroups.com
Hey, I'm using elementary OS (Luna), based on Ubuntu 12.04 LTS

Petar Korponaić

unread,
Sep 25, 2014, 3:28:57 PM9/25/14
to meteo...@googlegroups.com
Kitchen is working perfectly in Ubuntu 12.04 (I made it in Ubuntu 12.04). Are you using 64-bit version? (kitchen doesn't work in 32-bit OS).

Also, message is strange: "meteor-kitchen" is binary file and there is no code that can produce error like that, so I am curious what it can be ( :o )

Petar Korponaić

unread,
Sep 25, 2014, 3:37:19 PM9/25/14
to meteo...@googlegroups.com
Maybe you can try to add execute permissions and run kitchen without "sudo":

sudo chmod +x /usr/local/bin/meteor-kitchen

--
You received this message because you are subscribed to a topic in the Google Groups "meteor-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/meteor-talk/zXgP7ddCdHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to meteor-talk...@googlegroups.com.

Jan S

unread,
Sep 25, 2014, 3:49:02 PM9/25/14
to meteo...@googlegroups.com
Oh really? Yeah I'm running 32bit version :/ didn't know about that

Petar Korponaić

unread,
Sep 26, 2014, 12:45:50 AM9/26/14
to meteo...@googlegroups.com
Sorry. You can remove it by typing:

sudo rm -rf ~/.meteor-kitchen
sudo rm -rf /usr/local/bin/meteor-kitchen

Cheers!
Petar

Jan S

unread,
Sep 26, 2014, 2:41:11 AM9/26/14
to meteo...@googlegroups.com
Ok thanks. Is there a reason why only 64bit is supported? You should put up a note at meteorkitchen.com on the docs. There's just a note that Meteo needs to be installed!

Jan S

unread,
Sep 26, 2014, 4:48:47 AM9/26/14
to meteo...@googlegroups.com
Another question:

Is it possible to use checkboxes, radio buttons or select with meteor-kitchens form component?

Petar Korponaić

unread,
Sep 26, 2014, 9:52:02 AM9/26/14
to meteo...@googlegroups.com
1. The reason why only 64-bit OS is supported is: To be honest, I am too lazy to cross-compile it or install 32-bit OS in VM and compile it, and then bundle and upload it each time I change something :)

2. Yes, it's possible to use checkboxes, radio-buttons and selects: you can define field (inside form, or globaly inside collection definition) like this:

  "name": "someField",
  "title": "Some field", 
  "input": "radio", 
  "input_items": [
    { "value": "someValueForFirstItem", "title": "First item title" },
    { "value": "someValueForSecondItem", "title": "Second item title" },
    ...
  ]
}
 
(the same for checkbox or select: "type" should be "checkbox" or "select")

Jan S

unread,
Oct 2, 2014, 6:58:22 AM10/2/14
to meteo...@googlegroups.com
Is cross-compiling a big thing? Wouldn't it be great to target a bigger group of users for your Meteor generator? ;)

Jan S

unread,
Oct 5, 2014, 4:13:16 AM10/5/14
to meteo...@googlegroups.com
Is there a way to integrate templates (and their helpers), that are not generated, but already defined in a package that will be added afterwards to a route or a page in general? I have no idea how to do that. Thank you in advance!

Petar Korponaić

unread,
Oct 5, 2014, 6:25:11 PM10/5/14
to meteo...@googlegroups.com
Sorry Jan, I don't understand your question. Can you please explain better (maybe with some example).

Petar Korponaić

unread,
Oct 6, 2014, 2:29:06 AM10/6/14
to meteo...@googlegroups.com
If I understand well, maybe this can help you:

You can add generic component into page and write your own html and js code, like this:

{
 
"name": "my_component",
 
"title": "My cool component",
 
"type": "component", // type "component" is generic and requires custom template
 
"custom_template": "relative_path/something" // you need to provide something.html and something.js, path is relative to input json file
 
"query": {
   
"name": "some_query",
   
"collection": "some_collection",
   
"filter": {}
 
}
 
...
}


Your HTML and JS file can contain anything. Your component can contain other components, can use query - the same as any other built in component. 

If you want your component to be reusable in multiple pages, then you should use tokens in HTML and JS files that will be replaced by generator, for example:

something.html

<template name="TEMPLATE_NAME">
 
<h1>COMPONENT_TITLE</h1>

 
<ul>
    {{#each QUERY_VAR}}
     
<li>
        {{some_field}}
     
</li>
    {{/each}}
 
</ul>
</template>


something.js

Template.TEMPLATE_NAME.helpers({
 
"itemCount": function() { return QUERY_VAR.count(); }
});


Template.TEMPLATE_NAME.events({
 
"click h1": function(e, t) { /* do something */ }
});


Generator will automatically replace strings:

COMPONENT_ID
TEMPLATE_NAME
COMPONENT_TITLE
COMPONENT_CLASS
QUERY_VAR
COLLECTION_VAR
APP_TITLE



On Sunday, October 5, 2014 10:13:16 AM UTC+2, Jan S wrote: