{"id":16589879,"url":"https://github.com/codypearce/codegroundjs","last_synced_at":"2025-03-21T13:31:14.099Z","repository":{"id":57202325,"uuid":"78079804","full_name":"codypearce/codegroundjs","owner":"codypearce","description":"Real time HTML/CSS/JS editor playground","archived":false,"fork":false,"pushed_at":"2017-04-22T02:03:35.000Z","size":170,"stargazers_count":34,"open_issues_count":9,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-19T20:41:33.383Z","etag":null,"topics":["css","html","javascript","playground","realtime","self-hosted"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codypearce.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-05T04:38:12.000Z","updated_at":"2025-03-13T06:54:29.000Z","dependencies_parsed_at":"2022-09-11T06:50:34.095Z","dependency_job_id":null,"html_url":"https://github.com/codypearce/codegroundjs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codypearce%2Fcodegroundjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codypearce%2Fcodegroundjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codypearce%2Fcodegroundjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codypearce%2Fcodegroundjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codypearce","download_url":"https://codeload.github.com/codypearce/codegroundjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244806088,"owners_count":20513377,"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","html","javascript","playground","realtime","self-hosted"],"created_at":"2024-10-11T23:10:16.451Z","updated_at":"2025-03-21T13:31:13.844Z","avatar_url":"https://github.com/codypearce.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codeground.js\n\n[![Build Status](https://travis-ci.org/codypearce/codegroundjs.svg?branch=master)](https://travis-ci.org/codypearce/codegroundjs) [![npm version](https://badge.fury.io/js/codegroundjs.svg)](https://badge.fury.io/js/codegroundjs)  [![Bower](https://img.shields.io/bower/v/bootstrap.svg)](https://bower.io/search/)\n\nAn HTML, CSS, and JS playground plugin for self-hosted demos or playgrounds. Similar to a self-hosted embedded Codepen or JSFiddle. Layout options for fullscreen mode, tabs, or rows. Toggle splitscreen view and full view to show off just results or a particular code snippet.\n\n\u003cimg src=\"https://raw.githubusercontent.com/codypearce/codegroundjs/master/assets/codeground.png\" height=\"350\"\u003e\n\n## Install\n\n#### [NPM](https://www.npmjs.com/package/codegroundjs)\n```\nnpm install --save codegroundjs\n```\n\n### [Bower](https://bower.io/search/)\n```\nbower install --save codegroundjs\n```\n\nInclude the script on your page or include it in your build process\n```\n\u003clink rel=\"stylesheet\" href=\"/node_modules/codegroundjs/dist/codeground.min.css\" \u003e\n\u003cscript src=\"/node_modules/codegroundjs/dist/Codeground.min.js\"\u003e\u003c/script\u003e\n```\n\n## Features\n\n* Tabs view (show one language at a time) or Rows view (show all languages in rows ontop of each other)\n* Fullscreen mode\n* Preset values for demos\n* Disable a language\n* No dependencies\n\n## Use\n\nTo create a new playground you need to define an element with the id you want to target, then create a new codeground instance passing in the id of the element you created and pass in the options you want, \n```\nvar codeground = new Codeground('codeground', opts);\n```\nThis will create a new codeground in that div with your preset options.\n\n## Options\n\n```\nvar opts = {\n    html: 'demo.html', // add preset html, css, js by adding a path to the file you want\n    css: 'demo.css',\n    js:  'demo.js',\n    \n    htmlStr: '\u003cdiv\u003efoo\u003c/div\u003e', // add preset string values for html, css, or js\n    cssStr: '* { color: black}', // this will override the file you provide\n    jsStr: 'console.log('test')', \n    \n    htmlShow: true, // setting these to false hides that languages editor\n    cssShow: true, // if set false on tabs it hides the button\n    jsShow: true,\n\n    layout: 'half', // whether editor/output takes up full width or half\n    initialFull: 'editors', // this sets the initial view if you choose layout full\n\n    style: 'rows', // Toggle between rows and tabs view\n    initialTab: 'html', // if tabs are selected this selects the initial shown tab\n    \n    fullscreen: false, // html, body, and container must be 100% also\n\n    topbar: true, // this sets a top bar, required for the tabs view\n    title: 'Codeground' // optional title for the tab\n}\n\nvar codeground = new Codeground('codeground', opts);\n\n```\nTabs:\n\n\u003cimg src=\"https://raw.githubusercontent.com/codypearce/codegroundjs/master/assets/codeground.png\" height=\"200\"\u003e\n\nRows:\n\n\u003cimg src=\"https://raw.githubusercontent.com/codypearce/codegroundjs/master/assets/codeground-rows.png\" height=\"200\"\u003e\n\n## Use Cases\nWhy not just use Codepen or JSFiddle? These are great services that are easy to use and offer many useful features. However, there are a few advantages a hosted solution like this one has over a cloud solution:\n\n* Reduce HTTP requests\n* Track the playground in your codebase\n* More customizable\n* Don't have to clutter codepen account with simple demos\n* Not dependent on external service's uptime\n* Build on it to make something different\n\nOn the other hand, cloud solutions have a plethora of other advantages also, such as ease of use, options to fork, and many others. If you're in doubt then use Codepen/JSFiddle.\n\n### Browser Support\nShould work on all the latest browsers. Older versions will probably have issues.\n\n### Errors\n#### XMLHttpRequest cannot load\nThis error appears in chrome when you're presetting one of the languages by including a file. This is a security feature in chrome to prevent loading files from different domains, to solve this simply start a server and serve your index and the demo files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodypearce%2Fcodegroundjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodypearce%2Fcodegroundjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodypearce%2Fcodegroundjs/lists"}