pug-ruby 1.0.2 → 2.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.rubocop.yml +81 -0
- data/.travis.yml +17 -8
- data/.yardopts +4 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +32 -0
- data/LICENSE +21 -0
- data/README.md +256 -24
- data/Rakefile +74 -8
- data/lib/jade-pug/base.rb +178 -0
- data/lib/jade-pug/compiler.rb +166 -0
- data/lib/jade-pug/config.rb +60 -0
- data/lib/jade-pug/errors/compilation-error.rb +14 -0
- data/lib/jade-pug/errors/compiler-error.rb +13 -0
- data/lib/jade-pug/shipped-compiler.rb +80 -0
- data/lib/jade-pug/system-compiler.rb +139 -0
- data/lib/jade-ruby/compilation-essentials.rb +24 -0
- data/lib/jade-ruby/config.rb +17 -44
- data/lib/jade-ruby/errors/compilation-error.rb +14 -0
- data/lib/jade-ruby/errors/compiler-error.rb +13 -0
- data/lib/jade-ruby/shipped-compiler.rb +15 -0
- data/lib/jade-ruby/system-compiler.rb +15 -0
- data/lib/pug-ruby.rb +46 -5
- data/lib/pug-ruby/compilation-essentials.rb +29 -0
- data/lib/pug-ruby/config.rb +11 -37
- data/lib/pug-ruby/errors/compilation-error.rb +14 -0
- data/lib/pug-ruby/errors/compiler-error.rb +13 -0
- data/lib/pug-ruby/shipped-compiler.rb +15 -0
- data/lib/pug-ruby/system-compiler.rb +15 -0
- data/lib/pug-ruby/version.rb +7 -0
- data/package.json +11 -0
- data/pug-ruby.gemspec +19 -12
- data/support/browserify-jade-runtime.js +19 -0
- data/support/browserify-jade.js +17 -0
- data/support/browserify-pug-runtime.js +19 -0
- data/support/browserify-pug.js +23 -0
- data/support/minify-jade.js +11 -0
- data/support/minify-pug.js +11 -0
- data/test/helper.rb +202 -0
- data/test/jade/includes/includes/footer.jade +1 -1
- data/test/manual.html +21 -0
- data/test/manual.rb +25 -0
- data/test/pug/includes/includes/footer.pug +1 -1
- data/test/pug/index.pug +3 -3
- data/test/test-jade.rb +3 -67
- data/test/test-pug.rb +3 -67
- data/vendor/jade-1.0.0.min.js +1 -0
- data/vendor/jade-1.0.1.min.js +1 -0
- data/vendor/jade-1.0.2.min.js +1 -0
- data/vendor/jade-1.1.0.min.js +1 -0
- data/vendor/jade-1.1.1.min.js +1 -0
- data/vendor/jade-1.1.2.min.js +1 -0
- data/vendor/jade-1.1.3.min.js +1 -0
- data/vendor/jade-1.1.4.min.js +1 -0
- data/vendor/jade-1.1.5.min.js +1 -0
- data/vendor/jade-1.10.0.min.js +1 -0
- data/vendor/jade-1.11.0.min.js +1 -0
- data/vendor/jade-1.2.0.min.js +1 -0
- data/vendor/jade-1.3.0.min.js +1 -0
- data/vendor/jade-1.3.1.min.js +1 -0
- data/vendor/jade-1.4.0.min.js +1 -0
- data/vendor/jade-1.4.1.min.js +1 -0
- data/vendor/jade-1.4.2.min.js +1 -0
- data/vendor/jade-1.5.0.min.js +1 -0
- data/vendor/jade-1.6.0.min.js +1 -0
- data/vendor/jade-1.7.0.min.js +1 -0
- data/vendor/jade-1.8.0.min.js +1 -0
- data/vendor/jade-1.8.1.min.js +1 -0
- data/vendor/jade-1.8.2.min.js +1 -0
- data/vendor/jade-1.9.0.min.js +1 -0
- data/vendor/jade-1.9.1.min.js +1 -0
- data/vendor/jade-1.9.2.min.js +1 -0
- data/vendor/jade-runtime-1.0.0-license +22 -0
- data/vendor/jade-runtime-1.0.0.js +199 -0
- data/vendor/jade-runtime-1.0.1-license +22 -0
- data/vendor/jade-runtime-1.0.1.js +199 -0
- data/vendor/jade-runtime-1.0.2-license +22 -0
- data/vendor/jade-runtime-1.0.2.js +199 -0
- data/vendor/jade-runtime-1.1.0-license +22 -0
- data/vendor/jade-runtime-1.1.0.js +199 -0
- data/vendor/jade-runtime-1.1.1-license +22 -0
- data/vendor/jade-runtime-1.1.1.js +199 -0
- data/vendor/jade-runtime-1.1.2-license +22 -0
- data/vendor/jade-runtime-1.1.2.js +200 -0
- data/vendor/jade-runtime-1.1.3-license +22 -0
- data/vendor/jade-runtime-1.1.3.js +200 -0
- data/vendor/jade-runtime-1.1.4-license +22 -0
- data/vendor/jade-runtime-1.1.4.js +200 -0
- data/vendor/jade-runtime-1.1.5-license +22 -0
- data/vendor/jade-runtime-1.1.5.js +200 -0
- data/vendor/jade-runtime-1.10.0-license +22 -0
- data/vendor/jade-runtime-1.10.0.js +233 -0
- data/vendor/jade-runtime-1.11.0-license +22 -0
- data/vendor/jade-runtime-1.11.0.js +246 -0
- data/vendor/jade-runtime-1.2.0-license +22 -0
- data/vendor/jade-runtime-1.2.0.js +200 -0
- data/vendor/jade-runtime-1.3.0-license +22 -0
- data/vendor/jade-runtime-1.3.0.js +200 -0
- data/vendor/jade-runtime-1.3.1-license +22 -0
- data/vendor/jade-runtime-1.3.1.js +200 -0
- data/vendor/jade-runtime-1.4.0-license +22 -0
- data/vendor/jade-runtime-1.4.0.js +200 -0
- data/vendor/jade-runtime-1.4.1-license +22 -0
- data/vendor/jade-runtime-1.4.1.js +200 -0
- data/vendor/jade-runtime-1.4.2-license +22 -0
- data/vendor/jade-runtime-1.4.2.js +200 -0
- data/vendor/jade-runtime-1.5.0-license +22 -0
- data/vendor/jade-runtime-1.5.0.js +200 -0
- data/vendor/jade-runtime-1.6.0-license +22 -0
- data/vendor/jade-runtime-1.6.0.js +200 -0
- data/vendor/jade-runtime-1.7.0-license +22 -0
- data/vendor/jade-runtime-1.7.0.js +200 -0
- data/vendor/jade-runtime-1.8.0-license +22 -0
- data/vendor/jade-runtime-1.8.0.js +228 -0
- data/vendor/jade-runtime-1.8.1-license +22 -0
- data/vendor/jade-runtime-1.8.1.js +228 -0
- data/vendor/jade-runtime-1.8.2-license +22 -0
- data/vendor/jade-runtime-1.8.2.js +228 -0
- data/vendor/jade-runtime-1.9.0-license +22 -0
- data/vendor/jade-runtime-1.9.0.js +228 -0
- data/vendor/jade-runtime-1.9.1-license +22 -0
- data/vendor/jade-runtime-1.9.1.js +228 -0
- data/vendor/jade-runtime-1.9.2-license +22 -0
- data/vendor/jade-runtime-1.9.2.js +228 -0
- data/vendor/pug-2.0.0-beta.12-license +22 -0
- data/vendor/pug-2.0.0-beta.12.min.js +1 -0
- data/vendor/pug-2.0.0-beta1-license +22 -0
- data/vendor/pug-2.0.0-beta1.min.js +1 -0
- data/vendor/pug-2.0.0-beta10-license +22 -0
- data/vendor/pug-2.0.0-beta10.min.js +1 -0
- data/vendor/pug-2.0.0-beta11-license +22 -0
- data/vendor/pug-2.0.0-beta11.min.js +1 -0
- data/vendor/pug-2.0.0-beta2-license +22 -0
- data/vendor/pug-2.0.0-beta2.min.js +1 -0
- data/vendor/pug-2.0.0-beta3-license +22 -0
- data/vendor/pug-2.0.0-beta3.min.js +1 -0
- data/vendor/pug-2.0.0-beta4-license +22 -0
- data/vendor/pug-2.0.0-beta4.min.js +1 -0
- data/vendor/pug-2.0.0-beta5-license +22 -0
- data/vendor/pug-2.0.0-beta5.min.js +1 -0
- data/vendor/pug-2.0.0-beta6-license +22 -0
- data/vendor/pug-2.0.0-beta6.min.js +1 -0
- data/vendor/pug-2.0.0-beta7-license +22 -0
- data/vendor/pug-2.0.0-beta7.min.js +1 -0
- data/vendor/pug-2.0.0-beta8-license +22 -0
- data/vendor/pug-2.0.0-beta8.min.js +1 -0
- data/vendor/pug-2.0.0-beta9-license +22 -0
- data/vendor/pug-2.0.0-beta9.min.js +1 -0
- data/vendor/pug-2.0.0-rc.1-license +22 -0
- data/vendor/pug-2.0.0-rc.1.min.js +1 -0
- data/vendor/pug-2.0.0-rc.2-license +22 -0
- data/vendor/pug-2.0.0-rc.2.min.js +1 -0
- data/vendor/pug-2.0.0-rc.3-license +22 -0
- data/vendor/pug-2.0.0-rc.3.min.js +1 -0
- data/vendor/pug-runtime-2.0.0-license +19 -0
- data/vendor/pug-runtime-2.0.0.js +266 -0
- data/vendor/pug-runtime-2.0.1-license +19 -0
- data/vendor/pug-runtime-2.0.1.js +266 -0
- data/vendor/pug-runtime-2.0.2-license +19 -0
- data/vendor/pug-runtime-2.0.2.js +267 -0
- metadata +242 -13
- data/lib/jade-ruby/compile.rb +0 -79
- data/lib/pug-ruby/compile.rb +0 -88
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9aa23c41b83a1717528e1aa9dc496b6d0fd83c16
|
4
|
+
data.tar.gz: '0234974dc3e87481d6ef79e812af08c9250e1ab9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40553d0204e7d973609ccaa4bf37c8bd947f0bbb25a449b9097dca7f6411777cbb581171bc7a02b0e3fef0214652991118dcaffe60df1e865e9fa05e4f7b23b1
|
7
|
+
data.tar.gz: b995486264f39ed7ad5ed275db5ac9204f97e09586b00677b93fe62123e1003ce68b1cb4864ca91200aada12f9ad19bf7400acb8a235e85951bdf1aeb2eaf3ec
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
Style/StringLiterals:
|
2
|
+
EnforcedStyle: double_quotes
|
3
|
+
|
4
|
+
Metrics/LineLength:
|
5
|
+
Enabled: false
|
6
|
+
Max: 110
|
7
|
+
|
8
|
+
Style/FileName:
|
9
|
+
Regex: !ruby/regexp /\A[-a-z0-9]+\z/
|
10
|
+
|
11
|
+
Layout/CaseIndentation:
|
12
|
+
EnforcedStyle: end
|
13
|
+
IndentOneStep: true
|
14
|
+
|
15
|
+
Layout/AccessModifierIndentation:
|
16
|
+
EnforcedStyle: outdent
|
17
|
+
|
18
|
+
Layout/SpaceInsideArrayPercentLiteral:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
Layout/EmptyLinesAroundClassBody:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Style/PerlBackrefs:
|
25
|
+
Enabled: false
|
26
|
+
|
27
|
+
Bundler/OrderedGems:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
Metrics/BlockLength:
|
31
|
+
Enabled: false
|
32
|
+
|
33
|
+
Style/EmptyMethod:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Lint/UselessAssignment:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Lint/EndAlignment:
|
40
|
+
EnforcedStyleAlignWith: variable
|
41
|
+
|
42
|
+
Lint/UnusedBlockArgument:
|
43
|
+
Enabled: false
|
44
|
+
|
45
|
+
Metrics/MethodLength:
|
46
|
+
Max: 20
|
47
|
+
|
48
|
+
Layout/ExtraSpacing:
|
49
|
+
Enabled: false
|
50
|
+
AllowForAlignment: true
|
51
|
+
ForceEqualSignAlignment: true
|
52
|
+
|
53
|
+
Style/PercentLiteralDelimiters:
|
54
|
+
PreferredDelimiters:
|
55
|
+
default: '[]'
|
56
|
+
'%i': '[]'
|
57
|
+
'%': '{}'
|
58
|
+
|
59
|
+
Layout/AlignParameters:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Lint/UnusedMethodArgument:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Style/StringLiteralsInInterpolation:
|
66
|
+
EnforcedStyle: double_quotes
|
67
|
+
|
68
|
+
Layout/SpaceBeforeBlockBraces:
|
69
|
+
Enabled: true
|
70
|
+
|
71
|
+
Layout/SpaceInsideBlockBraces:
|
72
|
+
Enabled: true
|
73
|
+
|
74
|
+
Layout/SpaceInsideHashLiteralBraces:
|
75
|
+
Enabled: true
|
76
|
+
|
77
|
+
Style/DoubleNegation:
|
78
|
+
Enabled: false
|
79
|
+
|
80
|
+
Style/CaseEquality:
|
81
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,17 +1,26 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
-
- 2.0
|
5
|
-
- 2.1
|
6
|
-
- 2.2
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
4
|
+
- 2.0
|
5
|
+
- 2.1
|
6
|
+
- 2.2
|
7
|
+
- 2.3
|
8
|
+
- 2.4
|
9
9
|
|
10
10
|
cache: bundler
|
11
11
|
|
12
12
|
env:
|
13
|
-
-
|
13
|
+
- RAKE_ENV=test BUNDLE_PATH=vendor/bundle
|
14
14
|
|
15
15
|
before_install:
|
16
|
-
-
|
17
|
-
-
|
16
|
+
- . $HOME/.nvm/nvm.sh
|
17
|
+
- nvm install stable
|
18
|
+
- nvm use stable
|
19
|
+
- npm install --global jade pug
|
20
|
+
- gem install bundler
|
21
|
+
|
22
|
+
install:
|
23
|
+
- bundle install
|
24
|
+
|
25
|
+
script:
|
26
|
+
- bundle exec rake test
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
pug-ruby (2.0.0)
|
5
|
+
execjs (~> 2.0)
|
6
|
+
memoist (~> 0.15)
|
7
|
+
method-not-implemented (~> 1.0, >= 1.0.1)
|
8
|
+
regexp-match-polyfill (~> 1.0, >= 1.0.2)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
execjs (2.7.0)
|
14
|
+
memoist (0.16.0)
|
15
|
+
method-not-implemented (1.0.1)
|
16
|
+
power_assert (1.0.2)
|
17
|
+
rake (10.5.0)
|
18
|
+
regexp-match-polyfill (1.0.2)
|
19
|
+
test-unit (3.2.5)
|
20
|
+
power_assert
|
21
|
+
|
22
|
+
PLATFORMS
|
23
|
+
ruby
|
24
|
+
|
25
|
+
DEPENDENCIES
|
26
|
+
bundler (~> 1.7)
|
27
|
+
pug-ruby!
|
28
|
+
rake (~> 10.0)
|
29
|
+
test-unit (~> 3.1)
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
1.15.3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Yaroslav Konoplov
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,53 +1,285 @@
|
|
1
|
-
## Ruby wrapper for the
|
1
|
+
## Ruby wrapper for the Jade and Pug
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/pug-ruby.svg)](https://badge.fury.io/rb/pug-ruby)
|
4
4
|
[![Build Status](https://travis-ci.org/yivo/pug-ruby.svg?branch=master)](https://travis-ci.org/yivo/pug-ruby)
|
5
5
|
|
6
|
+
<img width="49.710808069%" alt="jade" align="left" src="https://user-images.githubusercontent.com/7421323/29007509-4fb4e004-7b0d-11e7-9b21-6bdd98a24344.png">
|
7
|
+
|
8
|
+
<img width="48.035162854%" alt="pug" src="https://user-images.githubusercontent.com/7421323/29007510-4fcdb638-7b0d-11e7-80c7-e3c49434ca8a.png">
|
9
|
+
|
6
10
|
## About
|
7
|
-
|
8
|
-
|
11
|
+
|
12
|
+
This gem allows to invoke Jade / Pug from the Ruby code.
|
13
|
+
|
14
|
+
**You can compile both Jade and Pug:**
|
15
|
+
|
16
|
+
* supports Jade [1.x.x](https://github.com/pugjs/pug/tree/v1.x.x).
|
17
|
+
* supports Pug [2.x.x](https://github.com/pugjs/pug/tree/master).
|
18
|
+
|
19
|
+
**You can choose what compiler to use:**
|
20
|
+
|
21
|
+
* *system compiler* – compiler that is installed globally via NPM.
|
22
|
+
* *shipped compiler* – compiler that is shipped with the gem as Web version.
|
23
|
+
|
24
|
+
Available versions of shipped compilers are listed below.
|
25
|
+
|
26
|
+
**You can lock the Jade / Pug version:**
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
NEEDED_JADE_VERSION = "1.9.2"
|
30
|
+
|
31
|
+
unless Jade.compiler.version == NEEDED_JADE_VERSION
|
32
|
+
raise "Jade #{NEEDED_JADE_VERSION} needed. You have #{Jade.compiler.version}."
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
**You can configure globally or per compilation:**
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Jade.config.pretty = true
|
40
|
+
Jade.compile "div Hello, Jade!", pretty: false
|
41
|
+
```
|
42
|
+
|
43
|
+
**You can render template or compile it to the JavaScript function:**
|
44
|
+
|
9
45
|
```ruby
|
10
|
-
Jade.compile
|
11
|
-
|
46
|
+
Jade.compile "div=greeting", locals: { greeting: "Hello, Jade!" } # => "<div>Hello, Jade!</div>"
|
47
|
+
Jade.compile "div=greeting", client: true # => "(function(jade) { function template(locals) {var buf = [];var jade_mixins = {};var jade_interp;;var locals_for_with = (locals || {});(function (greeting) {buf.push("<div>" + (jade.escape(null == (jade_interp = greeting) ? "" : jade_interp)) + "</div>");}.call(this,"greeting" in locals_for_with?locals_for_with.greeting:typeof greeting!=="undefined"?greeting:undefined));;return buf.join("");}; return template; }).call(this, jade);"
|
48
|
+
```
|
49
|
+
|
50
|
+
**Advanced language features like `include`, `extends` and `block` are supported (only system compilers):**
|
51
|
+
```jade
|
52
|
+
//- File: /var/www/app/views/header.jade
|
53
|
+
ul
|
54
|
+
li: a(href='/') Home
|
55
|
+
```
|
56
|
+
|
57
|
+
```jade
|
58
|
+
//- File: /var/www/app/views/layout.jade
|
59
|
+
doctype html
|
60
|
+
html
|
61
|
+
head
|
62
|
+
title Application
|
63
|
+
body
|
64
|
+
header
|
65
|
+
include ./header.jade
|
66
|
+
```
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
Jade.use :system
|
70
|
+
|
71
|
+
Jade.compile File.read("/var/www/app/views/layout.jade"), filename: "/var/www/app/views/layout.jade"
|
72
|
+
# => "<!DOCTYPE html><html><head><title>Application</title></head><body><header><ul><li><a href="/">Home</a></li></ul></header></body></html>"
|
12
73
|
```
|
13
74
|
|
14
75
|
## Installing gem
|
15
|
-
Run `gem install pug-ruby -v '~> 1.0'`. Add `require 'pug-ruby'` to your code.
|
16
76
|
|
77
|
+
**RubyGems users**
|
78
|
+
|
79
|
+
1. Run `gem install pug-ruby --version "~> 2.0.0"`.
|
80
|
+
2. Add `require "pug-ruby"` to your code.
|
81
|
+
|
82
|
+
**Bundler users**
|
17
83
|
|
18
|
-
|
19
|
-
<br>
|
20
|
-
Add to your Gemfile:
|
84
|
+
1. Add to your Gemfile:
|
21
85
|
```ruby
|
22
|
-
gem
|
86
|
+
gem "pug-ruby", "~> 2.0.0"
|
23
87
|
```
|
88
|
+
2. Run `bundle install`.
|
24
89
|
|
25
90
|
## Installing Jade
|
91
|
+
|
26
92
|
Install Jade globally via npm:
|
27
93
|
```bash
|
28
94
|
npm install --global jade
|
29
95
|
```
|
96
|
+
You may require `sudo` depending on your system.
|
30
97
|
|
31
98
|
## Installing Pug
|
99
|
+
|
32
100
|
Install Pug globally via npm:
|
33
101
|
```bash
|
34
|
-
npm install --global pug
|
102
|
+
npm install --global pug
|
35
103
|
```
|
104
|
+
You may require `sudo` depending on your system.
|
105
|
+
|
106
|
+
## Switching Jade / Pug version
|
107
|
+
|
108
|
+
The gem is shipped with different prebuilt versions of Jade and Pug.
|
109
|
+
That prebuilt versions are Web version, e.g. they are limited to browser JavaScript.
|
110
|
+
Advanced Jade / Pug features like `includes`, `extends`, `block`, and other require filesystem access.
|
111
|
+
You will not be able to use that features while dealing with shipped Jade / Pug.
|
112
|
+
Use system Jade / Pug in such cases.
|
113
|
+
|
114
|
+
**Switching the version permanently:**
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
Pug.use "2.0.0" # You have just switched to shipped Pug 2.0.0.
|
118
|
+
Pug.compiler.version # Returns "2.0.0".
|
119
|
+
|
120
|
+
Pug.use :system # You have just switched to system Pug.
|
121
|
+
Pug.compiler.version # Returns the version of your system-wide installed Pug.
|
122
|
+
```
|
123
|
+
|
124
|
+
**Switching the version temporarily:**
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
Jade.use "1.11.0" # You have just switched to shipped Jade 1.11.0.
|
128
|
+
|
129
|
+
Jade.use "1.9.2" do
|
130
|
+
# You have just switched to shipped Jade 1.9.2.
|
131
|
+
Jade.compiler.version # Returns "1.9.2".
|
132
|
+
|
133
|
+
# Do you stuff.
|
134
|
+
end
|
135
|
+
|
136
|
+
# You have been switched back to the 1.11.0.
|
137
|
+
Jade.compiler.version # Returns "1.11.0".
|
138
|
+
```
|
139
|
+
|
140
|
+
**Switching to the system Jade / Pug:**
|
141
|
+
|
142
|
+
```ruby
|
143
|
+
# Pass :system to switch to the system Jade / Pug.
|
144
|
+
Jade.use :system
|
145
|
+
Pug.use :system
|
146
|
+
```
|
147
|
+
|
148
|
+
**Shipped versions of Jade:**
|
149
|
+
|
150
|
+
* 1.0.0
|
151
|
+
* 1.0.1
|
152
|
+
* 1.0.2
|
153
|
+
* 1.1.0
|
154
|
+
* 1.1.1
|
155
|
+
* 1.1.2
|
156
|
+
* 1.1.3
|
157
|
+
* 1.1.4
|
158
|
+
* 1.1.5
|
159
|
+
* 1.2.0
|
160
|
+
* 1.3.0
|
161
|
+
* 1.3.1
|
162
|
+
* 1.4.0
|
163
|
+
* 1.4.1
|
164
|
+
* 1.4.2
|
165
|
+
* 1.5.0
|
166
|
+
* 1.6.0
|
167
|
+
* 1.7.0
|
168
|
+
* 1.8.0
|
169
|
+
* 1.8.1
|
170
|
+
* 1.8.2
|
171
|
+
* 1.9.0
|
172
|
+
* 1.9.1
|
173
|
+
* 1.9.2
|
174
|
+
* 1.10.0
|
175
|
+
* 1.11.0
|
176
|
+
|
177
|
+
**Shipped versions of Jade runtime:**
|
178
|
+
|
179
|
+
* 1.0.0
|
180
|
+
* 1.0.1
|
181
|
+
* 1.0.2
|
182
|
+
* 1.1.0
|
183
|
+
* 1.1.1
|
184
|
+
* 1.1.2
|
185
|
+
* 1.1.3
|
186
|
+
* 1.1.4
|
187
|
+
* 1.1.5
|
188
|
+
* 1.2.0
|
189
|
+
* 1.3.0
|
190
|
+
* 1.3.1
|
191
|
+
* 1.4.0
|
192
|
+
* 1.4.1
|
193
|
+
* 1.4.2
|
194
|
+
* 1.5.0
|
195
|
+
* 1.6.0
|
196
|
+
* 1.7.0
|
197
|
+
* 1.8.0
|
198
|
+
* 1.8.1
|
199
|
+
* 1.8.2
|
200
|
+
* 1.9.0
|
201
|
+
* 1.9.1
|
202
|
+
* 1.9.2
|
203
|
+
* 1.10.0
|
204
|
+
* 1.11.0
|
205
|
+
|
206
|
+
**Shipped versions of Pug:**
|
207
|
+
|
208
|
+
* 2.0.0-beta1
|
209
|
+
* 2.0.0-beta2
|
210
|
+
* 2.0.0-beta3
|
211
|
+
* 2.0.0-beta4
|
212
|
+
* 2.0.0-beta5
|
213
|
+
* 2.0.0-beta6
|
214
|
+
* 2.0.0-beta7
|
215
|
+
* 2.0.0-beta8
|
216
|
+
* 2.0.0-beta9
|
217
|
+
* 2.0.0-beta10
|
218
|
+
* 2.0.0-beta11
|
219
|
+
* 2.0.0-beta.12 (the dot is not an error)
|
220
|
+
* 2.0.0-rc.1
|
221
|
+
* 2.0.0-rc.2
|
222
|
+
* 2.0.0-rc.3
|
223
|
+
|
224
|
+
**Shipped versions of Pug runtime:**
|
225
|
+
|
226
|
+
* 2.0.0
|
227
|
+
* 2.0.1
|
228
|
+
* 2.0.2
|
229
|
+
|
230
|
+
## Configuring Jade / Pug
|
231
|
+
|
232
|
+
**Accessing configuration:**
|
233
|
+
|
234
|
+
```ruby
|
235
|
+
Jade.config
|
236
|
+
```
|
237
|
+
|
238
|
+
**Getting configuration options:**
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
Jade.config.pretty # => false
|
242
|
+
Jade.config.pretty? # => false
|
243
|
+
```
|
244
|
+
|
245
|
+
**Setting configuration options:**
|
246
|
+
|
247
|
+
```ruby
|
248
|
+
Jade.config.pretty = true
|
249
|
+
```
|
250
|
+
|
251
|
+
**Setting custom configuration options:**
|
252
|
+
|
253
|
+
```ruby
|
254
|
+
Jade.config.custom_option = "value"
|
255
|
+
```
|
256
|
+
|
257
|
+
**Serializing configuration:**
|
258
|
+
|
259
|
+
```ruby
|
260
|
+
Jade.config.to_h
|
261
|
+
# => { filename: nil, doctype: nil, pretty: false, self: false, compile_debug: false, globals: [], name: "template" }
|
262
|
+
```
|
263
|
+
|
264
|
+
**The documentation for configuration options can be found here:**
|
265
|
+
|
266
|
+
* [Official Jade website (Web Archive only)](http://web.archive.org/web/*/jade-lang.com/api)
|
267
|
+
* [Jade CLI utility reference](https://github.com/pugjs/pug/blob/v1.x.x/bin/jade.js)
|
268
|
+
* [Official Pug website](https://pugjs.org/api/reference.html)
|
269
|
+
* [Pug CLI utility reference](https://github.com/pugjs/pug-cli/blob/master/index.js)
|
270
|
+
|
271
|
+
**Pass an options to `Jade#compile` or `Pug#compile` as second argument to override global config:**
|
36
272
|
|
37
|
-
## Configuring Pug and Jade
|
38
|
-
Access Pug and Jade configurations:
|
39
273
|
```ruby
|
40
|
-
Jade.
|
41
|
-
|
274
|
+
Jade.compile "h1 Title\ndiv Content"
|
275
|
+
# => "<h1>Title</h1><div>Content</div>"
|
276
|
+
|
277
|
+
Jade.compile "h1 Title\ndiv Content", pretty: true
|
278
|
+
# => "<h1>Title</h1>\n<div>Content</div>"
|
42
279
|
```
|
43
280
|
|
44
|
-
|
45
|
-
<br>
|
46
|
-
[pugjs.org](https://pugjs.org)
|
47
|
-
<br>
|
48
|
-
[jade-lang.com (sorry, webarchive only)](http://web.archive.org/web/*/jade-lang.com)
|
281
|
+
## Running tests
|
49
282
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
3. Finally run tests: `bundle exec rake test`
|
283
|
+
1. Install both Jade and Pug: `npm install --global jade pug`.
|
284
|
+
2. Install gem dependencies: `bundle install`.
|
285
|
+
3. Finally, run tests: `bundle exec rake test`.
|