Skip to content

Instantly share code, notes, and snippets.

View AdeptSEO's full-sized avatar

Веб-студия «AdeptSEO» AdeptSEO

View GitHub Profile
@AdeptSEO
AdeptSEO / .gulpfile
Created March 9, 2022 15:32 — forked from IcarusFW/.gulpfile
Nunjucks - JSON into Template Macro
var manageEnvironment = function(environment) {
environment.addFilter("json", function(value) {
return JSON.parse(value); // convert the complete string imported by Nunjucks into JSON and return
});
};
gulp.task("nunjucks", function() {
// .njk files in pages
return (
gulp
{# Import macros for global use in all views #}
{% set components = {} %}
{% for component in macroFilePaths %}
{% import component as temp %}{% set macro = _.assign(components, temp) %}
{% endfor %}
{# end #}
@IcarusFW
IcarusFW / .gulpfile
Last active August 3, 2022 12:52
Nunjucks - JSON into Template Macro
var manageEnvironment = function(environment) {
environment.addFilter("json", function(value) {
return JSON.parse(value); // convert the complete string imported by Nunjucks into JSON and return
});
};
gulp.task("nunjucks", function() {
// .njk files in pages
return (
gulp
@RRMoelker
RRMoelker / highlightjs-tag-nunjucks.js
Created December 5, 2019 15:22
Nunjuck highlight.js tag extension
//
// Allows highlighting of code blocks in Nunjucks template.
// https://mozilla.github.io/nunjucks/api.html#custom-tags
//
const nunjucks = require('nunjucks');
const hljs = require('highlight.js');
function HighlightJsExtension() {
this.tags = ['highlightjs'];