@nakedcreativity/cee-ms-node 0.3.24 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -8
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -160,19 +160,23 @@ function ceems(config) {
|
|
|
160
160
|
render: function(scope, hash){
|
|
161
161
|
// var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
if(site.collections[
|
|
166
|
-
//console.log(site.collections[
|
|
167
|
-
var collection = JSON.parse(fs.readFileSync('./data/'+site.collections[
|
|
163
|
+
var collectionName = Liquid.evalValue(this.match[0], scope)
|
|
164
|
+
|
|
165
|
+
if(site.collections[collectionName]){
|
|
166
|
+
//console.log(site.collections[collection]._id)
|
|
167
|
+
var collection = JSON.parse(fs.readFileSync('./data/'+site.collections[collectionName]._id+'.json', 'utf8'));
|
|
168
168
|
|
|
169
169
|
var scopeObj = {}
|
|
170
|
-
scopeObj[
|
|
170
|
+
scopeObj['collection'] = collection
|
|
171
171
|
scope.push(scopeObj)
|
|
172
172
|
|
|
173
173
|
//console.log(scope)
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
var template = Liquid.lexical.parseLiteral(this.match[1])
|
|
175
|
+
if (!template) {
|
|
176
|
+
template = this.match[1]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return engine.handleCache(template+'.liquid')
|
|
176
180
|
.then((templates) => {
|
|
177
181
|
return engine.renderer.renderTemplates(templates, scope);
|
|
178
182
|
})
|
|
@@ -245,6 +249,11 @@ function ceems(config) {
|
|
|
245
249
|
render: function(scope, hash) {
|
|
246
250
|
var image = Liquid.evalExp(this.args[0], scope);
|
|
247
251
|
//console.log(image)
|
|
252
|
+
|
|
253
|
+
if(!image){
|
|
254
|
+
return Promise.resolve('')
|
|
255
|
+
}
|
|
256
|
+
|
|
248
257
|
if(this.args[1] && image.variants && image.variants[this.args[1]]){
|
|
249
258
|
var src = image.variants[this.args[1]]
|
|
250
259
|
}else {
|
|
@@ -261,6 +270,11 @@ function ceems(config) {
|
|
|
261
270
|
},
|
|
262
271
|
render: function(scope, hash) {
|
|
263
272
|
var image = Liquid.evalExp(this.args[0], scope);
|
|
273
|
+
|
|
274
|
+
if(!image){
|
|
275
|
+
return Promise.resolve('')
|
|
276
|
+
}
|
|
277
|
+
|
|
264
278
|
//console.log(image)
|
|
265
279
|
if(this.args[1] && image.variants && image.variants[this.args[1]]){
|
|
266
280
|
var src = image.variants[this.args[1]]
|