{"id":14967622,"url":"https://github.com/yivo/pug-ruby","last_synced_at":"2026-03-03T21:32:30.310Z","repository":{"id":56889551,"uuid":"68543762","full_name":"yivo/pug-ruby","owner":"yivo","description":"🐶 Compile Jade and Pug from Ruby.","archived":false,"fork":false,"pushed_at":"2018-08-12T09:49:51.000Z","size":1840,"stargazers_count":34,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-02-01T19:55:30.540Z","etag":null,"topics":["gem","jade","jade-template-engine","jade-templates","pug","pug-template-engine","pug-templates","pugjs","ruby","ruby-gem"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/yivo.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":"2016-09-18T19:51:18.000Z","updated_at":"2025-12-17T20:30:26.000Z","dependencies_parsed_at":"2022-08-20T16:00:25.546Z","dependency_job_id":null,"html_url":"https://github.com/yivo/pug-ruby","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/yivo/pug-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yivo%2Fpug-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yivo%2Fpug-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yivo%2Fpug-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yivo%2Fpug-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yivo","download_url":"https://codeload.github.com/yivo/pug-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yivo%2Fpug-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30062422,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gem","jade","jade-template-engine","jade-templates","pug","pug-template-engine","pug-templates","pugjs","ruby","ruby-gem"],"created_at":"2024-09-24T13:38:22.308Z","updated_at":"2026-03-03T21:32:30.274Z","avatar_url":"https://github.com/yivo.png","language":"Ruby","readme":"## 🐶 Compile Jade and Pug from Ruby\n\n[![Gem Version](https://badge.fury.io/rb/pug-ruby.svg)](https://badge.fury.io/rb/pug-ruby)\n[![Build Status](https://travis-ci.org/yivo/pug-ruby.svg?branch=master)](https://travis-ci.org/yivo/pug-ruby)\n\n\u003cimg width=\"49.710808069%\" alt=\"jade\" align=\"left\" src=\"https://user-images.githubusercontent.com/7421323/29007509-4fb4e004-7b0d-11e7-9b21-6bdd98a24344.png\"\u003e\n\n\u003cimg width=\"48.035162854%\" alt=\"pug\" src=\"https://user-images.githubusercontent.com/7421323/29007510-4fcdb638-7b0d-11e7-80c7-e3c49434ca8a.png\"\u003e\n\n## About\n\n`pug-ruby` is a gem that allows you to easily compile Jade and Pug templates from Ruby.\n\n**You can compile both Jade and Pug:**\n\n* supports Jade [1.x.x](https://github.com/pugjs/pug/tree/v1.x.x).\n* supports Pug [2.x.x](https://github.com/pugjs/pug/tree/master).\n \n**You can choose what compiler to use:**\n\n* *system compiler* – compiler that is installed globally via NPM.\n* *shipped compiler* – compiler that is shipped with the gem as Web version.\n \nAvailable versions of shipped compilers are listed below.\n \n**You can lock the Jade / Pug version:**\n\n```ruby\nNEEDED_JADE_VERSION = \"1.9.2\"\n\nunless Jade.compiler.version == NEEDED_JADE_VERSION\n  raise \"Jade #{NEEDED_JADE_VERSION} needed. You have #{Jade.compiler.version}.\"\nend\n```\n\n**You can configure globally or per compilation:**\n\n```ruby\nJade.config.pretty = true\nJade.compile \"div Hello, Jade!\", pretty: false\n```\n\n**You can render template or compile it to the JavaScript function:**\n\n```ruby\nJade.compile \"div=greeting\", locals: { greeting: \"Hello, Jade!\" } # =\u003e \"\u003cdiv\u003eHello, Jade!\u003c/div\u003e\"\nJade.compile \"div=greeting\", client: true                         # =\u003e \"(function(jade) { function template(locals) {var buf = [];var jade_mixins = {};var jade_interp;;var locals_for_with = (locals || {});(function (greeting) {buf.push(\"\u003cdiv\u003e\" + (jade.escape(null == (jade_interp = greeting) ? \"\" : jade_interp)) + \"\u003c/div\u003e\");}.call(this,\"greeting\" in locals_for_with?locals_for_with.greeting:typeof greeting!==\"undefined\"?greeting:undefined));;return buf.join(\"\");}; return template; }).call(this, jade);\"\n```\n \n**Advanced language features like `include`, `extends` and `block` are supported (only system compilers):**\n```jade\n//- File: /var/www/app/views/header.jade\nul\n  li: a(href='/') Home\n```\n\n```jade\n//- File: /var/www/app/views/layout.jade\ndoctype html\nhtml\n  head\n      title Application\n  body\n    header\n      include ./header.jade\n```\n\n```ruby\nJade.use :system\n\nJade.compile File.read(\"/var/www/app/views/layout.jade\"), filename: \"/var/www/app/views/layout.jade\"\n  # =\u003e \"\u003c!DOCTYPE html\u003e\u003chtml\u003e\u003chead\u003e\u003ctitle\u003eApplication\u003c/title\u003e\u003c/head\u003e\u003cbody\u003e\u003cheader\u003e\u003cul\u003e\u003cli\u003e\u003ca href=\"/\"\u003eHome\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\u003c/header\u003e\u003c/body\u003e\u003c/html\u003e\"\n```\n\n## Installing gem\n\n**RubyGems users**\n\n1. Run `gem install pug-ruby --version \"~\u003e 2.0.0\"`. \n2. Add `require \"pug-ruby\"` to your code.\n\n**Bundler users**\n\n1. Add to your Gemfile:\n```ruby\ngem \"pug-ruby\", \"~\u003e 2.0.0\"\n```\n2. Run `bundle install`.\n\n## Installing Jade\n\nOnly install if you want to use **system** compiler.\n\nInstall Jade globally via npm:\n```bash\nnpm install --global jade\n```\nYou may require `sudo` depending on your system.\n\n## Installing Pug\n\nOnly install if you want to use **system** compiler.\n\nInstall Pug globally via npm:\n```bash\nnpm install --global pug\n```\nYou may require `sudo` depending on your system.\n\n## Switching Jade / Pug version\n\nThe gem is shipped with different prebuilt versions of Jade and Pug.\nThat prebuilt versions are Web version, e.g. they are limited to browser JavaScript.\nAdvanced Jade / Pug features like `includes`, `extends`, `block`, and others require filesystem access.\nYou will not be able to use that features while dealing with shipped Jade / Pug.\nUse system Jade / Pug in such cases.\n\n**Switching the version permanently:**\n\n```ruby\nPug.use \"2.0.0\"      # You have just switched to shipped Pug 2.0.0.\nPug.compiler.version # Returns \"2.0.0\".\n\nPug.use :system      # You have just switched to system Pug.\nPug.compiler.version # Returns the version of your system-wide installed Pug.\n```\n\n**Switching the version temporarily:**\n\n```ruby\nJade.use \"1.11.0\" # You have just switched to shipped Jade 1.11.0.\n\nJade.use \"1.9.2\" do\n  # You have just switched to shipped Jade 1.9.2.\n  Jade.compiler.version # Returns \"1.9.2\".\n\n  # Do you stuff.\nend\n\n# You have been switched back to the 1.11.0.\nJade.compiler.version # Returns \"1.11.0\".\n```\n\n**Switching to the system Jade / Pug:**\n\n```ruby\n# Pass :system to switch to the system Jade / Pug.\nJade.use :system\nPug.use  :system\n```\n\n**Shipped versions of Jade:**\n\n* 1.0.0\n* 1.0.1\n* 1.0.2\n* 1.1.0\n* 1.1.1\n* 1.1.2\n* 1.1.3\n* 1.1.4\n* 1.1.5\n* 1.2.0\n* 1.3.0\n* 1.3.1\n* 1.4.0\n* 1.4.1\n* 1.4.2\n* 1.5.0\n* 1.6.0\n* 1.7.0\n* 1.8.0\n* 1.8.1\n* 1.8.2\n* 1.9.0\n* 1.9.1\n* 1.9.2\n* 1.10.0\n* 1.11.0\n\n**Shipped versions of Jade runtime:**\n\n* 1.0.0\n* 1.0.1\n* 1.0.2\n* 1.1.0\n* 1.1.1\n* 1.1.2\n* 1.1.3\n* 1.1.4\n* 1.1.5\n* 1.2.0\n* 1.3.0\n* 1.3.1\n* 1.4.0\n* 1.4.1\n* 1.4.2\n* 1.5.0\n* 1.6.0\n* 1.7.0\n* 1.8.0\n* 1.8.1\n* 1.8.2\n* 1.9.0\n* 1.9.1\n* 1.9.2\n* 1.10.0\n* 1.11.0\n\n**Shipped versions of Pug:**\n\n* 2.0.0-beta1\n* 2.0.0-beta2\n* 2.0.0-beta3\n* 2.0.0-beta4\n* 2.0.0-beta5\n* 2.0.0-beta6\n* 2.0.0-beta7\n* 2.0.0-beta8\n* 2.0.0-beta9\n* 2.0.0-beta10\n* 2.0.0-beta11\n* 2.0.0-beta12\n* 2.0.0-rc.1\n* 2.0.0-rc.2\n* 2.0.0-rc.3\n* 2.0.0-rc.4\n* 2.0.1\n* 2.0.2\n* 2.0.3\n\n**Shipped versions of Pug runtime:**\n\n* 2.0.0\n* 2.0.1\n* 2.0.2\n\n## Configuring Jade / Pug\n\n**Accessing configuration:**\n\n```ruby\nJade.config\n```\n\n**Getting configuration options:**\n\n```ruby\nJade.config.pretty  # =\u003e false\nJade.config.pretty? # =\u003e false\n```\n\n**Setting configuration options:**\n\n```ruby\nJade.config.pretty = true\n```\n\n**Setting custom configuration options:**\n\n```ruby\nJade.config.custom_option = \"value\"\n```\n\n**Serializing configuration:**\n\n```ruby\nJade.config.to_h\n  # =\u003e { filename: nil, doctype: nil, pretty: false, self: false, compile_debug: false, globals: [], name: \"template\" }\n```\n\n**The documentation for configuration options can be found here:**\n\n* [Official Jade website (Web Archive only)](http://web.archive.org/web/*/jade-lang.com/api)\n* [Jade CLI utility reference](https://github.com/pugjs/pug/blob/v1.x.x/bin/jade.js)\n* [Official Pug website](https://pugjs.org/api/reference.html)\n* [Pug CLI utility reference](https://github.com/pugjs/pug-cli/blob/master/index.js)\n\n**Pass an options to `Jade#compile` or `Pug#compile` as second argument to override global config:**\n\n```ruby\nJade.compile \"h1 Title\\ndiv Content\"\n  # =\u003e \"\u003ch1\u003eTitle\u003c/h1\u003e\u003cdiv\u003eContent\u003c/div\u003e\"\n  \nJade.compile \"h1 Title\\ndiv Content\", pretty: true\n  # =\u003e \"\u003ch1\u003eTitle\u003c/h1\u003e\\n\u003cdiv\u003eContent\u003c/div\u003e\"  \n```\n\n## Running tests\n\n1. Install both Jade and Pug: `npm install --global jade pug`.\n2. Install gem dependencies: `bundle install`.\n3. Finally, run tests: `bundle exec rake test`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyivo%2Fpug-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyivo%2Fpug-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyivo%2Fpug-ruby/lists"}