@nakedcreativity/cee-ms-node 0.3.20 → 0.3.22
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 +36 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -160,17 +160,17 @@ function ceems(config) {
|
|
|
160
160
|
render: function(scope, hash){
|
|
161
161
|
// var filepath = Liquid.evalValue(this.match[1]+'.liquid', scope);
|
|
162
162
|
|
|
163
|
-
console.log('look for data collection', this.match[0])
|
|
163
|
+
//console.log('look for data collection', this.match[0])
|
|
164
164
|
|
|
165
165
|
if(site.collections[this.match[0]]){
|
|
166
|
-
console.log(site.collections[this.match[0]]._id)
|
|
166
|
+
//console.log(site.collections[this.match[0]]._id)
|
|
167
167
|
var collection = JSON.parse(fs.readFileSync('./data/'+site.collections[this.match[0]]._id+'.json', 'utf8'));
|
|
168
168
|
|
|
169
169
|
var scopeObj = {}
|
|
170
170
|
scopeObj[this.match[0]] = collection.data
|
|
171
171
|
scope.push(scopeObj)
|
|
172
172
|
|
|
173
|
-
console.log(scope)
|
|
173
|
+
//console.log(scope)
|
|
174
174
|
|
|
175
175
|
return engine.handleCache(this.match[1]+'.liquid')
|
|
176
176
|
.then((templates) => {
|
|
@@ -197,6 +197,39 @@ function ceems(config) {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
})
|
|
200
|
+
|
|
201
|
+
this.engine.registerTag('image', {
|
|
202
|
+
parse: function(tagToken, remainTokens) {
|
|
203
|
+
this.args = tagToken.args.split(' ');
|
|
204
|
+
},
|
|
205
|
+
render: function(scope, hash) {
|
|
206
|
+
var image = Liquid.evalExp(this.args[0], scope);
|
|
207
|
+
//console.log(image)
|
|
208
|
+
if(this.args[1] && image.variants && image.variants[this.args[1]]){
|
|
209
|
+
var src = image.variants[this.args[1]]
|
|
210
|
+
}else {
|
|
211
|
+
var src = image.src
|
|
212
|
+
}
|
|
213
|
+
var alt = image.alt || ''
|
|
214
|
+
return Promise.resolve('<img src="'+src+'" alt="'+alt+'"/>');
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
this.engine.registerTag('imageurl', {
|
|
219
|
+
parse: function(tagToken, remainTokens) {
|
|
220
|
+
this.args = tagToken.args.split(' ');
|
|
221
|
+
},
|
|
222
|
+
render: function(scope, hash) {
|
|
223
|
+
var image = Liquid.evalExp(this.args[0], scope);
|
|
224
|
+
//console.log(image)
|
|
225
|
+
if(this.args[1] && image.variants && image.variants[this.args[1]]){
|
|
226
|
+
var src = image.variants[this.args[1]]
|
|
227
|
+
}else {
|
|
228
|
+
var src = image.src
|
|
229
|
+
}
|
|
230
|
+
return Promise.resolve(src);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
200
233
|
|
|
201
234
|
this.engine.registerTag('breadcrumb', {
|
|
202
235
|
parse: function(tagToken, remainTokens) {
|