{"id":25564762,"url":"https://github.com/coditorium/nodejs-swig-loader","last_synced_at":"2025-04-12T10:10:05.320Z","repository":{"id":28017089,"uuid":"31511946","full_name":"coditorium/nodejs-swig-loader","owner":"coditorium","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-13T08:50:56.000Z","size":26,"stargazers_count":9,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T05:03:06.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/coditorium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-01T21:44:29.000Z","updated_at":"2019-03-24T02:38:31.000Z","dependencies_parsed_at":"2024-06-19T04:09:06.131Z","dependency_job_id":"3b9fb142-5d37-4faf-8f14-2a683fd93c9b","html_url":"https://github.com/coditorium/nodejs-swig-loader","commit_stats":{"total_commits":24,"total_committers":4,"mean_commits":6.0,"dds":"0.16666666666666663","last_synced_commit":"3953f92793adde0c290b1fa4ad91031049e4f268"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditorium%2Fnodejs-swig-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditorium%2Fnodejs-swig-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditorium%2Fnodejs-swig-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coditorium%2Fnodejs-swig-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coditorium","download_url":"https://codeload.github.com/coditorium/nodejs-swig-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125593,"owners_count":21051771,"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":[],"created_at":"2025-02-20T21:59:36.645Z","updated_at":"2025-04-12T10:10:05.300Z","avatar_url":"https://github.com/coditorium.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Swig loader\n\n[![Travis build status](https://travis-ci.org/coditorium/nodejs-swig-loader.png?branch=master)](https://travis-ci.org/coditorium/nodejs-swig-loader)\n[![dependencies](https://david-dm.org/coditorium/nodejs-swig-loader.png)](https://david-dm.org/coditorium/nodejs-swig-loader)\n[![Coverage Status](https://coveralls.io/repos/coditorium/nodejs-swig-loader/badge.svg)](https://coveralls.io/r/coditorium/nodejs-swig-loader)\n\n[![NPM info](https://nodei.co/npm/swig-loader.png?downloads=true)](https://www.npmjs.com/package/swig-loader)\n\nWebpack loader for [swig](http://paularmstrong.github.io/swig) templates.\n\n## How to use\n\n### Webpack configuration\n\nYou can define swig loader using webpack configuration.\n\n``` javascript\n{\n  module: {\n    loaders: [\n      { test: /\\.swig$/, loader: \"swig-loader\" }\n    ]\n  }\n};\n```\n\n### Require parameter\n\nYou can load swig template using require parameter.\n\n``` javascript\nvar template = require('swig!./template.swig');\n```\n\n### Passing swig options\n\nYou can pass [swig options](http://paularmstrong.github.io/swig/docs/api/#SwigOpts) to the loader using `swigLoader.options({ ... })` or loader query parameters. If you choose loader query parameters take a look at query [webpack standard query format](https://github.com/webpack/loader-utils#parsequery).\n\n``` javascript\n// Option #1 - Swig loader global options\nvar swigLoader = require('swig-loader');\nswigLoader.options({\n  varControls: ['{:', ':}']\n});\n\n// Option #2 - Swig loader query parameters\nvar swigLoader = require('swig?varControls[]={:\u0026varControls[]=:}!./template.swig');\n```\n\n### Passing template parameters\n\nYou can pass template parameters to the loader using resource query parameters. If you need to pass some parameters take a look at query [webpack standard query format](https://github.com/webpack/loader-utils#parsequery).\n\n``` javascript\nvar swigLoader = require('swig!./template.swig?username=John');\n```\n\n### Customizers\n\nYou can customize `query`, `resourceQuery` and `result` using customizers:\n\n``` javascript\nvar swigLoader = require('swig-loader');\n\nswigLoader.queryCustomizer(function(query, templatepath) {\n    // modify query\n});\n\nswigLoader.resourceQueryCustomizer(function(resourceQuery, templatepath) {\n    // modify resource query\n});\n\nswigLoader.resultCustomizer(function(query, templatepath, resourceQuery, query) {\n    // modify result and don't forget to return it!\n    return result;\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditorium%2Fnodejs-swig-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoditorium%2Fnodejs-swig-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoditorium%2Fnodejs-swig-loader/lists"}