{"id":16906613,"url":"https://github.com/rsms/js-fragment","last_synced_at":"2025-04-11T15:26:43.709Z","repository":{"id":66105790,"uuid":"805188","full_name":"rsms/js-fragment","owner":"rsms","description":"Client-side templating for modern thinkers","archived":false,"fork":false,"pushed_at":"2010-08-09T01:49:12.000Z","size":188,"stargazers_count":25,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T12:41:50.397Z","etag":null,"topics":[],"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/rsms.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":"2010-07-29T11:52:27.000Z","updated_at":"2024-11-28T13:10:38.000Z","dependencies_parsed_at":"2023-02-19T22:35:15.904Z","dependency_job_id":null,"html_url":"https://github.com/rsms/js-fragment","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/rsms%2Fjs-fragment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsms%2Fjs-fragment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsms%2Fjs-fragment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsms%2Fjs-fragment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsms","download_url":"https://codeload.github.com/rsms/js-fragment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248429894,"owners_count":21101911,"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":[],"created_at":"2024-10-13T18:43:34.140Z","updated_at":"2025-04-11T15:26:43.676Z","avatar_url":"https://github.com/rsms.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-fragment\n\nClient-side templating for modern thinkers.\n\nRequires jQuery 1.4 or later. Tested in modern browsers (Chrome, Safari, Firefox). Patches are welcome.\n\n## Example\n\n    \u003cscript type=\"text/javascript\"\u003e\n      $(function(){\n        context.siteTitle = \"Fancy Restaurant\";\n        context.session = {username: \"john.doe\"};\n        $('body').append(fragment('header').fadeIn(200));\n        fragment('about/intro.html', function(err, frag){\n          if (err) return alert(err.stack);\n          $('body').append(frag.fadeIn(200));\n        });\n      });\n    \u003c/script\u003e\n    \u003cdiv fragment=\"header\"\u003e\n      \u003ch1\u003e{{siteTitle}}\u003c/h1\u003e\n      \u003cp\u003e\n        Welcome\n        {{#session}}back {{username}}!{{/session}}\n        {{^session}}stranger.{{/session}}\n      \u003c/p\u003e\n    \u003c/div\u003e\n\nRead [the introduction](http://hunch.se/js-fragment/) or look at the [source of some examples](http://github.com/rsms/js-fragment/blob/master/examples/basics.html) and [try them out in your browser](http://hunch.se/js-fragment/examples/basics.html).\n\n## Caveats\n\n- If Mustache processing is enabled, you must use the `mustacho.js` file bundled with `fragment.js` (the one in this repository), since fragment.js requires two things which are not in the regular mustache.js:\n  - pre and post filter hooks (for partials) so we can perform our own processing (e.g. markdown)\n  - preserve whitespace so to not mess upp markdown or other space and crlf sensitive markup.\n- Dependency: jQuery \u003e= 1.4\n\n### TODO\n\n- Make Mustache `{{\u003epartial}}`s asynchronous. Needed when the requested template is not yet loaded. Currently a partial must already be loaded when requested.\n\n## MIT license\n\nCopyright (c) 2010 Rasmus Andersson \u003chttp://hunch.se/\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsms%2Fjs-fragment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsms%2Fjs-fragment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsms%2Fjs-fragment/lists"}