{"id":16747570,"url":"https://github.com/differui/rollup-plugin-if","last_synced_at":"2025-03-16T02:24:27.485Z","repository":{"id":65491445,"uuid":"68175016","full_name":"differui/rollup-plugin-if","owner":"differui","description":"Roll JavaScript with if instructions.","archived":false,"fork":false,"pushed_at":"2017-01-12T04:55:21.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T05:17:42.693Z","etag":null,"topics":["rollup","rollup-plugin"],"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/differui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-14T05:06:56.000Z","updated_at":"2017-03-17T00:59:13.000Z","dependencies_parsed_at":"2023-01-25T18:55:11.515Z","dependency_job_id":null,"html_url":"https://github.com/differui/rollup-plugin-if","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/differui%2Frollup-plugin-if","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/differui%2Frollup-plugin-if/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/differui%2Frollup-plugin-if/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/differui%2Frollup-plugin-if/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/differui","download_url":"https://codeload.github.com/differui/rollup-plugin-if/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"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":["rollup","rollup-plugin"],"created_at":"2024-10-13T02:10:26.291Z","updated_at":"2025-03-16T02:24:26.777Z","avatar_url":"https://github.com/differui.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"rollup-plugin-if\n=====\n\n\u003cp\u003e\n    \u003ca href=\"LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"Software License\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/differui/rollup-plugin-if/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/differui/rollup-plugin-if.svg\" alt=\"Issues\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://standardjs.com/\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/code%20style-standard-brightgreen.svg\" alt=\"JavaScript Style Guide\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://npmjs.org/package/rollup\n        \u003cimg src=\"https://img.shields.io/npm/v/rollup-plugin-if.svg?style=flat-squar\" alt=\"NPM\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/differui/rollup-plugin-if/releases\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/release/differui/rollup-plugin-if.svg\" alt=\"Latest Version\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/differui/rollup-plugin-if\"\u003e\n        \u003cimg src=\"https://travis-ci.org/differui/rollup-plugin-if.svg?branch=master\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Install\n\n```bash\n$ npm install rollup-plugin-if -D\n```\n\n## Syntax\n\n```\n#[keyword] [expression]\n\n// javascript code goes here\n\n#end[keyword]\n```\n\n## Usage\n\n```js\nimport { rollup } from 'rollup';\nimport instruction from 'rollup-plugin-if';\n\nrollup({\n    entry: 'main.js',\n    plugins: [\n        instruction({\n            FLAG1: true,\n            FLAG2: true\n        })\n    ]\n}).then(...);\n```\n\n## Statements\n\n### `if`\n\n```js\n#if FLAG\nwindow.a = 1;\n#endif\n\nwindow.b = 2;\n```\n\n```json\n{\n    \"FLAG\": true\n}\n```\n\nwill yeild:\n\n```js\nwindow.a = 1;\nwindow.b = 2;\n```\n\n### `if`-`else`-`endif`\n\n```js\n#if FLAG\nwindow.a = 1;\n#else\nwindow.a = 2;\n#endif\n```\n\n```json\n{\n    \"FLAG\": true\n}\n```\n\nwill yeild:\n\n```js\nwindow.a = 1;\n```\n\n### `if`-`elif`-`else`-`endif`\n\n```js\n#if FLAG1\nwindow.a = 1;\n#elif FLAG2\nwindow.b = 2;\n#else\nwindow.c = 3;\n#endif\n```\n\n```json\n{\n    \"FLAG1\": false,\n    \"FLAG2\": false\n}\n```\n\nwill yeild:\n\n```js\nwindow.c = 3;\n```\n\n\n\n## License\n\nMIT \u0026copy; [BinRui.Guan](mailto:differui@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdifferui%2Frollup-plugin-if","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdifferui%2Frollup-plugin-if","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdifferui%2Frollup-plugin-if/lists"}