{"id":14982244,"url":"https://github.com/tuanpham-dev/gulp-liquidjs","last_synced_at":"2025-09-12T21:25:52.032Z","repository":{"id":57168212,"uuid":"189132188","full_name":"tuanpham-dev/gulp-liquidjs","owner":"tuanpham-dev","description":"A shopify compatible Liquid template engine in pure JavaScript.","archived":false,"fork":false,"pushed_at":"2020-05-05T12:50:00.000Z","size":27,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T01:11:20.314Z","etag":null,"topics":["gulp","gulp-plugin","javascript","liquid","npm","shopify"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tuanpham-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-29T01:58:02.000Z","updated_at":"2022-01-20T02:49:34.000Z","dependencies_parsed_at":"2022-09-04T01:02:06.858Z","dependency_job_id":null,"html_url":"https://github.com/tuanpham-dev/gulp-liquidjs","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuanpham-dev%2Fgulp-liquidjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuanpham-dev%2Fgulp-liquidjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuanpham-dev%2Fgulp-liquidjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tuanpham-dev%2Fgulp-liquidjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tuanpham-dev","download_url":"https://codeload.github.com/tuanpham-dev/gulp-liquidjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238817394,"owners_count":19535519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gulp","gulp-plugin","javascript","liquid","npm","shopify"],"created_at":"2024-09-24T14:05:00.977Z","updated_at":"2025-02-14T09:31:29.219Z","avatar_url":"https://github.com/tuanpham-dev.png","language":"JavaScript","readme":"# gulp-liquidjs\nA shopify compatible Liquid template engine for Gulp using [liquidjs](https://github.com/harttle/liquidjs).\n\n## Installation\n\n```bash\nnpm install --save-dev @tuanpham-dev/gulp-liquidjs\n```\n\n## Usage\n```javascript\nconst gulp = require('gulp')\nconst liquid = require('gulp-liquidjs')\n\ngulp.task('liquid', () =\u003e {\n  return gulp.src('./src/*.liquid')\n    .pipe(liquid())\n    .pipe(gulp.dest('./dist'))\n})\n```\n\nwith `gulp-data`\n```javascript\ngulp\n  .pipe(data(function(file) {\n  // build your data for liquid\n  })\n  .pipe(liquid())\n```\n\n## Options\nAll options are optional.\n\n### `engine`\nEngine options.\n\n```javascript\n.pipe(liquid({\n  engine: {\n    root: ['./src/liquid/templates', './src/liquid/snippets'],\n    extname: '.liquid'\n  }\n}))\n```\n\n* `root` is a directory or an array of directories to resolve layouts and includes, as well as the filename passed in when calling `.renderFile()`.\nIf an array, the files are looked up in the order they occur in the array.\nDefaults to `[\".\"]`\n\n* `extname` is used to lookup the template file when filepath doesn't include an extension name. Eg: setting to `\".html\"` will allow including file by basename. Defaults to `\".liquid\"`.\n\n* `cache` indicates whether or not to cache resolved templates. Defaults to `false`.\n\n* `dynamicPartials`: if set, treat `\u003cfilepath\u003e` parameter in `{%include filepath %}`, `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`.\n\n* `strictFilters` is used to enable strict filter existence. If set to `false`, undefined filters will be rendered as empty string. Otherwise, undefined filters will cause an exception. Defaults to `false`.\n\n* `strictVariables` is used to enable strict variable derivation. \nIf set to `false`, undefined variables will be rendered as empty string.\nOtherwise, undefined variables will cause an exception. Defaults to `false`.\n\n* `trimTagRight` is used to strip blank characters (including ` `, `\\t`, and `\\r`) from the right of tags (`{% %}`) until `\\n` (inclusive). Defaults to `false`.\n\n* `trimTagLeft` is similiar to `trimTagRight`, whereas the `\\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details.\n\n* `trimOutputRight` is used to strip blank characters (including ` `, `\\t`, and `\\r`) from the right of values (`{{ }}`) until `\\n` (inclusive). Defaults to `false`.\n\n* `trimOutputLeft` is similiar to `trimOutputRight`, whereas the `\\n` is exclusive. Defaults to `false`. See [Whitespace Control][whitespace control] for details.\n\n* `tagDelimiterLeft` and `tagDelimiterRight` are used to override the delimiter for liquid tags.\n\n* `outputDelimiterLeft` and `outputDelimiterRight` are used to override the delimiter for liquid outputs.\n\n* `greedy` is used to specify whether `trim*Left`/`trim*Right` is greedy. When set to `true`, all consecutive blank characters including `\\n` will be trimed regardless of line breaks. Defaults to `true`.\n\n\n### `ext`\nExtension name of destination filename. Defaults to `.html`.\n\n```javascript\n.pipe(liquid({\n  ext: '.html'\n}))\n```\n\n### `filters`\nArray of filter object to register custom filters: `{\u003cfilter_name\u003e: \u003cfilter_function\u003e}`.\n\n```javascript\n.pipe(liquid({\n  filters: {\n    // Usage: {{ name | upper }}\n    upper: v =\u003e v.toUpperCase(),\n    // Usage: {{ 1 | add: 2, 3 }}\n    add: (initial, arg1, arg2) =\u003e initial + arg1 + arg2\n  }\n}))\n```\n\nSee existing filter implementations here: \u003chttps://github.com/harttle/liquidjs/tree/master/src/builtin/filters\u003e\n\n### `tags`\nArray of tag object to register custom tags: `{\u003ctag_name\u003e : {parse: \u003cparse_function\u003e, render: \u003crender_function\u003e}}`\n\n```javascript\n.pipe(liquid({\n  tags: {\n    // Usage: {% upper name %}\n    \tupper: {\n      parse: (tagToken, remainTokens) =\u003e {\n        this.str = tagToken.args // name\n      },\n      render: async (scope, hash) {\n        var str = await liquid.evalValue(this.str, scope) // 'alice'\n        return str.toUpperCase() // 'ALICE\n      }\n    }\n  }\n}))\n```\n\n### `plugins`\nA pack of tags or filters can be encapsulated into a plugin, which will be typically installed via npm.\n\n```javascript\nconst somePlugin = require('./some-plugin')\n\ngulp.task('liquid', () =\u003e {\n  return gulp.src('./src/*.liquid')\n    .pipe(liquid({\n      plugins: [somePlugin]\n    }))\n    .pipe(gulp.dest('./dist'))\n})\n\n// some-plugin.js\nmodule.exports = (Liquid) =\u003e {\n  // here `this` refers to the engine instance\n  // `Liquid` provides facilities to implement tags and filters\n  this.registerFilter('foo', x =\u003e x);\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuanpham-dev%2Fgulp-liquidjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftuanpham-dev%2Fgulp-liquidjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftuanpham-dev%2Fgulp-liquidjs/lists"}