jade-rails 1.8.2.0 → 1.9.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/jade/version.rb +1 -1
- data/vendor/assets/javascripts/jade/jade.js +40 -29
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1efd81616df034adfbadab46e346124e47159786
|
4
|
+
data.tar.gz: acce583b683b4289a1bb60f0f61e2ada7c6e0f9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 387672ce7b135d2612f01b869fcc751a0472546054313140316112b4d6eab7e090e99e8b23f33584357741bec04faa668ff2025285fb3935910b7fcfdb8b217a
|
7
|
+
data.tar.gz: 4ae350b05f81d48925a0a40c359a44e94fa85a957f1da1cac83513d62a39143048b1f62ede13bde841da82e6dde517b89c54a1bd36cae0a77f6ce374e0c8afb3
|
data/README.md
CHANGED
@@ -11,7 +11,7 @@ to render Jade templates anywhere on the front end of your Rails app.
|
|
11
11
|
Add to your Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'jade-rails', '~> 1.
|
14
|
+
gem 'jade-rails', '~> 1.9.1.0'
|
15
15
|
```
|
16
16
|
|
17
17
|
In your `application.js`, require the Jade runtime before any files that include
|
data/lib/jade/version.rb
CHANGED
@@ -789,7 +789,7 @@ exports.filters = require('./filters');
|
|
789
789
|
* Utilities.
|
790
790
|
*/
|
791
791
|
|
792
|
-
exports.utils =
|
792
|
+
exports.utils = utils;
|
793
793
|
|
794
794
|
/**
|
795
795
|
* Expose `Compiler`.
|
@@ -898,6 +898,32 @@ function parse(str, options){
|
|
898
898
|
return {body: body, dependencies: parser.dependencies};
|
899
899
|
}
|
900
900
|
|
901
|
+
/**
|
902
|
+
* Get the template from a string or a file, either compiled on-the-fly or
|
903
|
+
* read from cache (if enabled), and cache the template if needed.
|
904
|
+
*
|
905
|
+
* If `str` is not set, the file specified in `options.filename` will be read.
|
906
|
+
*
|
907
|
+
* If `options.cache` is true, this function reads the file from
|
908
|
+
* `options.filename` so it must be set prior to calling this function.
|
909
|
+
*
|
910
|
+
* @param {Object} options
|
911
|
+
* @param {String=} str
|
912
|
+
* @return {Function}
|
913
|
+
* @api private
|
914
|
+
*/
|
915
|
+
function handleTemplateCache (options, str) {
|
916
|
+
var key = options.filename;
|
917
|
+
if (options.cache && exports.cache[key]) {
|
918
|
+
return exports.cache[key];
|
919
|
+
} else {
|
920
|
+
if (str === undefined) str = fs.readFileSync(options.filename, 'utf8');
|
921
|
+
var templ = exports.compile(str, options);
|
922
|
+
if (options.cache) exports.cache[key] = templ;
|
923
|
+
return templ;
|
924
|
+
}
|
925
|
+
}
|
926
|
+
|
901
927
|
/**
|
902
928
|
* Compile a `Function` representation of the given jade `str`.
|
903
929
|
*
|
@@ -942,7 +968,7 @@ exports.compile = function(str, options){
|
|
942
968
|
res.toString = function () {
|
943
969
|
var err = new Error('The `client` option is deprecated, use the `jade.compileClient` method instead');
|
944
970
|
err.name = 'Warning';
|
945
|
-
console.error(err.stack || err.message);
|
971
|
+
console.error(err.stack || /* istanbul ignore next */ err.message);
|
946
972
|
return exports.compileClient(str, options);
|
947
973
|
};
|
948
974
|
}
|
@@ -1008,17 +1034,8 @@ exports.compileClient = function(str, options){
|
|
1008
1034
|
*/
|
1009
1035
|
exports.compileFile = function (path, options) {
|
1010
1036
|
options = options || {};
|
1011
|
-
|
1012
|
-
var key = path + ':string';
|
1013
|
-
|
1014
1037
|
options.filename = path;
|
1015
|
-
|
1016
|
-
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8'))
|
1017
|
-
: fs.readFileSync(path, 'utf8');
|
1018
|
-
|
1019
|
-
return options.cache
|
1020
|
-
? exports.cache[path] || (exports.cache[path] = exports.compile(str, options))
|
1021
|
-
: exports.compile(str, options);
|
1038
|
+
return handleTemplateCache(options);
|
1022
1039
|
};
|
1023
1040
|
|
1024
1041
|
/**
|
@@ -1058,11 +1075,7 @@ exports.render = function(str, options, fn){
|
|
1058
1075
|
throw new Error('the "filename" option is required for caching');
|
1059
1076
|
}
|
1060
1077
|
|
1061
|
-
|
1062
|
-
var tmpl = options.cache
|
1063
|
-
? exports.cache[path] || (exports.cache[path] = exports.compile(str, options))
|
1064
|
-
: exports.compile(str, options);
|
1065
|
-
return tmpl(options);
|
1078
|
+
return handleTemplateCache(options, str)(options);
|
1066
1079
|
};
|
1067
1080
|
|
1068
1081
|
/**
|
@@ -1092,13 +1105,8 @@ exports.renderFile = function(path, options, fn){
|
|
1092
1105
|
|
1093
1106
|
options = options || {};
|
1094
1107
|
|
1095
|
-
var key = path + ':string';
|
1096
|
-
|
1097
1108
|
options.filename = path;
|
1098
|
-
|
1099
|
-
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8'))
|
1100
|
-
: fs.readFileSync(path, 'utf8');
|
1101
|
-
return exports.render(str, options);
|
1109
|
+
return handleTemplateCache(options)(options);
|
1102
1110
|
};
|
1103
1111
|
|
1104
1112
|
|
@@ -1112,16 +1120,19 @@ exports.renderFile = function(path, options, fn){
|
|
1112
1120
|
*/
|
1113
1121
|
|
1114
1122
|
exports.compileFileClient = function(path, options){
|
1123
|
+
var key = path + ':client';
|
1115
1124
|
options = options || {};
|
1116
1125
|
|
1117
|
-
var key = path + ':string';
|
1118
|
-
|
1119
1126
|
options.filename = path;
|
1120
|
-
var str = options.cache
|
1121
|
-
? exports.cache[key] || (exports.cache[key] = fs.readFileSync(path, 'utf8'))
|
1122
|
-
: fs.readFileSync(path, 'utf8');
|
1123
1127
|
|
1124
|
-
|
1128
|
+
if (options.cache && exports.cache[key]) {
|
1129
|
+
return exports.cache[key];
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
var str = fs.readFileSync(options.filename, 'utf8');
|
1133
|
+
var out = exports.compileClient(str, options);
|
1134
|
+
if (options.cache) exports.cache[key] = out;
|
1135
|
+
return out;
|
1125
1136
|
};
|
1126
1137
|
|
1127
1138
|
/**
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jade-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Raythattha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|