{"id":16254309,"url":"https://github.com/celer/cjade","last_synced_at":"2025-04-08T12:48:45.246Z","repository":{"id":2442580,"uuid":"3412810","full_name":"celer/cjade","owner":"celer","description":"Jade client side handler for express","archived":false,"fork":false,"pushed_at":"2013-06-07T05:20:54.000Z","size":164,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T08:51:32.412Z","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/celer.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":"2012-02-11T01:44:20.000Z","updated_at":"2016-04-26T22:22:10.000Z","dependencies_parsed_at":"2022-09-17T22:22:14.036Z","dependency_job_id":null,"html_url":"https://github.com/celer/cjade","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/celer%2Fcjade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fcjade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fcjade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/celer%2Fcjade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/celer","download_url":"https://codeload.github.com/celer/cjade/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247846877,"owners_count":21006090,"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-10T15:21:03.409Z","updated_at":"2025-04-08T12:48:45.225Z","avatar_url":"https://github.com/celer.png","language":"JavaScript","readme":"# cjade\n\nA simple request handler for express which compiles jade templates and\nmakes them avilable for client side use. \n\n# Requirements\n \n * Express.js\n * jQuery\n\n# Features\n\n * If a cache directory is specified templates will be compiled and cached\n * Ugilfy will be run on compiled templates\n * Proper HTTP caching will occur of templates\n\n# Usage\n\nNodeJS\n\n```javascript\n    var cjade = require('cjade')\n    ...\n    // templates - where to find the template files\n    // c_templates - where to cache compiled templates to\n    app.use(cjade(\"templates\",\"c_templates\"))\n```\n\nBrowser\n\n```javascript\n    \u003cscript src=\"jquery.js\"\u003e\n    \u003cscript src=\"/cjade/cjade.js\"\u003e\n\n    ..\n\n\t\t/**\n\t\t\tBasic utilty function to load the specified client side template\n\t\t*/\n    cjade(\"test.jade.js\",function(err,template){\n      $(\"#output\").append(template({ a:1, b:2 }))\n    });\n\t\t\n\n\t\t/**\n\t\t\tcjade.defaults can be used to set default values for the options specified below\n\t\t\t\n\t\t\tThere is no need to specify any defaults by default :P cjade will use it's own busy image, functions, etc \n\t\t*/\n\t\tcjade.defaults({\n\t\t\tbusyImage:\"/images/busy.gif\"\n\t\t});\n\n\t\t/**\n\t\t\tcjade.load is a utility function which:\n\t\t\t\t- provides a busy image functionality to be displayed while the template is loaded and business logic is executed\n\t\t\t\t- provides default error handling\n\n\t\t\t@param {string} selector\n\t\t\t\tjQuery selector\n\t\t\t@param {string} template to load\n\t\t\t\tthis template will be loaded and eventually rendered into the specified selector\n\t\t\t@param {object} options \n\t\t\t\toptional arguments\n\t\t\t\t@param {string} busyImage\t\n\t\t\t\t\tan image to be loaded while waiting for the utility function to finish\n\t\t\t\t@param {function} render(element,templateFunc,err,templateData)\n\t\t\t\t\tthis function is called when the render function defined below is called to populate the templateData using the templateFunc into the specified jQuery element\n\t\t\t\t@param {function} busy(element,options)\n\t\t\t\t\tthis function is called with the specified element prior to fetching the template and executing business logic\n\t\t\t\t@param {function} error(element,options,err)\n\t\t\t\t\tthis function is called when an error occurs\n\t\t\t@param {function} onComplete(err,next)\n\t\t\t\tthis function should contain business logic and is called after the template is loaded\n\t\t\t\t@param {string} err\n\t\t\t\t\tan error message\n\t\t\t\t@param {object} next\n\t\t\t\t\tan object which can be used to either render the template or specify an error\n\t\t\t\t\t@param {function} render(templateData)\n\t\t\t\t\t\tcalling this function will render the template into the specified jQuery selector utilizing the templateData\n\t\t\t\t\t@param {function} error(err) \n\t\t\t\t\t\tcalling this function will call the error function specified in the options\n\t\t*/\n\t\tcjade.load(\"#userView\",\"userView.jade.js\", function(err,next){\n\t\t\tif(!err){\n\t\t\t\tUserService.load({ id: user.id},function(err,user){\n\t\t\t\t\tif(err){\n\t\t\t\t\t\tnext.error(err);\n\t\t\t\t\t} else next.render(user);\n\t\t\t\t});\t\n\t\t\t} else {\n\t\t\t\treturn next.error(err);\n\t\t\t}\n\t\t});\n\t\n\t\t\n```\n\nSee examples/test.js for more examples\n\n## License \n\n(The MIT License)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceler%2Fcjade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fceler%2Fcjade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fceler%2Fcjade/lists"}