{"id":17038140,"url":"https://github.com/bchao1/griddy","last_synced_at":"2025-08-04T23:12:51.927Z","repository":{"id":57436058,"uuid":"196238314","full_name":"bchao1/griddy","owner":"bchao1","description":"📐📏 Generate CSS grid layouts FAST.","archived":false,"fork":false,"pushed_at":"2019-07-11T12:27:14.000Z","size":1357,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T08:37:05.196Z","etag":null,"topics":["css","flexbox","grid-layout","html","javascript","responsive"],"latest_commit_sha":null,"homepage":"","language":"Python","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/bchao1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-10T16:16:51.000Z","updated_at":"2019-12-22T19:47:15.000Z","dependencies_parsed_at":"2022-09-01T18:43:02.162Z","dependency_job_id":null,"html_url":"https://github.com/bchao1/griddy","commit_stats":null,"previous_names":["mckinsey666/griddy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2Fgriddy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2Fgriddy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2Fgriddy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bchao1%2Fgriddy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bchao1","download_url":"https://codeload.github.com/bchao1/griddy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248575957,"owners_count":21127301,"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":["css","flexbox","grid-layout","html","javascript","responsive"],"created_at":"2024-10-14T08:56:05.426Z","updated_at":"2025-04-12T13:52:01.108Z","avatar_url":"https://github.com/bchao1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `griddy`: Generate CSS grid layouts FAST\n\u003cp align=center\u003e\n\u003cimg src=\"./assets/logo.png\" width=\"200\"\u003e\n\u003c/p\u003e\n\n\u003e 📐📏 Tired of manually splitting `\u003cdiv\u003e`'s? Try **`griddy`**.\n\n\u003cp align=center\u003e\n\u003cimg src=\"./assets/demo.gif\" width=\"800\"\u003e\n\u003c/p\u003e\n\n## Setup \n### Build from source\n```\ngit clone https://github.com/Mckinsey666/griddy.git\ncd griddy\npip install .\n```\n### From **PyPI**\n```\npip install griddy\n```\n\n## Usage\n### Defining a `layout.json` file\nA layout `.json` file should follow the following syntax:\n- The json file contains one `json` object.\n- First level of the `json` object should have key `root`.\n- For (key, value) pairs in other levels, the keys should abide by the following conventions:\n    - `percentage`: percentage of the children `\u003cdiv\u003e`'s height or width with respect to its parent's.\n    - `layout type`: defines a column layout or a row layout (column layouts will be inside a flex container). If `r` is specified, the percentage is the relative height; if `c` is specified, the percentage is the relative width.\n    - `id` (optional): used to prevent duplicate keys in the `json` object.\n\n```\nkey = percentage + layout type + id\n```\n\n- For keys in the same level, their layout types should be the same.\n- For keys in the same level, it is better that their percentage add up to 100.\n- If no more `\u003cdiv\u003e`s are to be splitted, set the value of the key to be `null`.\n\n#### Sample `layout.json` file\n```json\n{\n    \"root\":{\n        \"70r\":{\n            \"10c\": null,\n            \"20c\": {\n                \"10r\": null,\n                \"90r\": null\n            },\n            \"70c\": {\n                \"50r1\": null,\n                \"50r2\": {\n                    \"20c1\": null,\n                    \"20c2\": null,\n                    \"60c\": null\n                }\n            }\n        },\n        \"30r\": {\n            \"80c\": null,\n            \"20c\": null\n        }\n    }\n}\n```\nPlay with more examples in the `examples` directory.\n\n#### Sample `index.html` output\n\n\u003cp align=center\u003e\n\u003cimg src=\"./assets/sample-color.png\" width=\"600\"\u003e\n\u003c/p\u003e\n\nHere `\u003cdiv\u003e` blocks are randomly colored for the sake of clarity with the `--colored` flag specified.\n\n\u003cp align=center\u003e\n\u003cimg src=\"./assets/sample-no-color.png\" width=\"600\"\u003e\n\u003c/p\u003e\n\nPlain borders surrounding blocks with `--border` flag specified.\n\n\u003cp align=center\u003e\n\u003cimg src=\"./assets/explanation.png\" width=\"600\"\u003e\n\u003c/p\u003e\n\nThe above picture shows how the `json` file syntax associates with actual layout generated.\n\n### Generate `html` and `css`\n```\ngriddy \u003cname of the layout file\u003e\n```\nAn `index.html` file and a `styles.css` file will be generated in the current working directory. You can simply plugin the generated grid `\u003cdiv\u003e` (top-level `\u003cdiv\u003e` of class `root` with style `width: 100%; height:100%`) anywhere in your existing code.\n\n### Command-line arguments\n|Arguments|Type|Explanation|\n|---|---|---|\n|**--colored**|bool|Whether to color the `\u003cdiv\u003e` blocks|\n|**--border**|bool|`\u003cdiv\u003e` blocks comes with borders|\n|**--show**|bool|Show generated grid in browser|\n\nFor example,\n```\ngriddy layout.json --border --show\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchao1%2Fgriddy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbchao1%2Fgriddy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbchao1%2Fgriddy/lists"}