{"id":13647395,"url":"https://github.com/mbasso/gccx","last_synced_at":"2025-10-26T00:43:07.718Z","repository":{"id":40591436,"uuid":"103015963","full_name":"mbasso/gccx","owner":"mbasso","description":"Transforms CPX (JSX like syntax) into asm-dom Virtual DOM","archived":false,"fork":false,"pushed_at":"2018-06-18T14:39:31.000Z","size":334,"stargazers_count":263,"open_issues_count":2,"forks_count":13,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-04-02T12:11:13.312Z","etag":null,"topics":["asm-dom","cpp","cpx","jsx","virtual-dom"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mbasso.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-10T08:53:43.000Z","updated_at":"2025-01-16T10:27:20.000Z","dependencies_parsed_at":"2022-08-24T23:40:23.827Z","dependency_job_id":null,"html_url":"https://github.com/mbasso/gccx","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Fgccx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Fgccx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Fgccx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mbasso%2Fgccx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mbasso","download_url":"https://codeload.github.com/mbasso/gccx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054193,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asm-dom","cpp","cpx","jsx","virtual-dom"],"created_at":"2024-08-02T01:03:32.306Z","updated_at":"2025-10-26T00:43:07.641Z","avatar_url":"https://github.com/mbasso.png","language":"JavaScript","readme":"# gccx\n\n[![Build Status](https://travis-ci.org/mbasso/gccx.svg?branch=master)](https://travis-ci.org/mbasso/gccx)\n[![npm version](https://img.shields.io/npm/v/gccx.svg)](https://www.npmjs.com/package/gccx)\n[![npm downloads](https://img.shields.io/npm/dm/gccx.svg?maxAge=2592000)](https://www.npmjs.com/package/gccx)\n[![MIT](https://img.shields.io/npm/l/gccx.svg)](https://github.com/mbasso/gccx/blob/master/LICENSE.md)\n\n\u003e Transforms CPX (JSX like syntax) into asm-dom Virtual DOM\n\n![Preview](preview.jpeg)\n\n## Motivation\n\n[asm-dom](https://github.com/mbasso/asm-dom) Virtual DOM is a little bit verbose to write, we need a lot, not to much readable, lines of code to create a view. In addition we have to convert some types, merge attributes, props and do other stuff like that every time. For this reason we have decided to create `gccx`, a parser that allows us to write a new simple syntax. We will call this syntax `CPX`, it is based on [JSX](https://facebook.github.io/jsx/) but it has some differences. Basically `gccx` will transform this syntax into standard C++. In this way we can write files that appear very similar to HTML and can be written and read easily.\n\n## Installation\n\nYou can install gccx using [npm](https://www.npmjs.com/package/gccx):\n\n```bash\nnpm install --save-dev gccx\n```\n\nor, if you prefer, you can install gccx globally with:\n\n```bash\nnpm install -g gccx\n```\n\n## Usage\n\nOnce you have installed gccx, you can use it from the command line or from javascript. Here is an example of both:\n\n```bash\ngccx src --output dist --watch\n```\n\nsupposing a CommonJS environment, you can import gccx in this way and immediately use it with no configuration.\n\n```js\nimport gccx from 'gccx';\n\nconst code = `\n  #include \"../asm-dom/asm-dom.hpp\"\n  #include \u003cemscripten/val.h\u003e\n  #include \u003cstring\u003e\n\n  using namespace asmdom;\n\n  int main() {\n    VNode* vnode = \u003ch1\u003eHello world!\u003c/h1\u003e;\n\n    patch(\n      emscripten::val::global(\"document\").call\u003cemscripten::val\u003e(\n        \"getElementById\",\n        std::string(\"root\")\n      ),\n      vnode\n    );\n\n    return 0;\n  };\n`;\n\nconst compiled = gccx.parse(code); // compiled code as string\n```\n\n## Documentation\n\nVisit [docs](https://github.com/mbasso/gccx/blob/master/docs) folder to find the complete doc of gccx.\n\n## Examples\n\nExamples are available in the [examples folder](https://github.com/mbasso/gccx/blob/master/examples). You will find examples of both, cli and javascript api usage.\n\nIf you want to see a complete example that uses gccx, you can check out [here](https://github.com/mbasso/asm-dom/tree/master/examples/todomvc%20-%20cpx) the TODOMVC.\n\n## Change Log\n\nThis project adheres to [Semantic Versioning](http://semver.org/).  \nEvery release, along with the migration instructions, is documented on the Github [Releases](https://github.com/mbasso/gccx/releases) page.\n\n## Authors\n**Matteo Basso**\n- [github/mbasso](https://github.com/mbasso)\n- [@teo_basso](https://twitter.com/teo_basso)\n\n## Copyright and License\nCopyright (c) 2017, Matteo Basso.\n\ngccx source code is licensed under the [MIT License](https://github.com/mbasso/gccx/blob/master/LICENSE.md).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbasso%2Fgccx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbasso%2Fgccx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbasso%2Fgccx/lists"}