{"id":21291665,"url":"https://github.com/komlev/grunt-remove-duplicates","last_synced_at":"2025-10-17T04:24:18.338Z","repository":{"id":22369690,"uuid":"25706017","full_name":"komlev/grunt-remove-duplicates","owner":"komlev","description":"plugin for removing duplicate scripts from html","archived":false,"fork":false,"pushed_at":"2021-05-30T17:46:19.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-13T04:03:04.982Z","etag":null,"topics":[],"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/komlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-10-24T20:11:15.000Z","updated_at":"2021-05-30T17:46:21.000Z","dependencies_parsed_at":"2022-07-23T18:19:26.279Z","dependency_job_id":null,"html_url":"https://github.com/komlev/grunt-remove-duplicates","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/komlev%2Fgrunt-remove-duplicates","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Fgrunt-remove-duplicates/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Fgrunt-remove-duplicates/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/komlev%2Fgrunt-remove-duplicates/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/komlev","download_url":"https://codeload.github.com/komlev/grunt-remove-duplicates/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243760548,"owners_count":20343649,"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":"2024-11-21T13:38:31.586Z","updated_at":"2025-10-17T04:24:13.290Z","avatar_url":"https://github.com/komlev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# grunt-remove-duplicates\n\n\u003e Removes scripts duplicates from HTML files\n\n## Getting Started\nThis plugin requires Grunt `~0.4.5`\n\nIf you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:\n\n```shell\nnpm install grunt-remove-duplicates --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('grunt-remove-duplicates');\n```\n\n## The \"remove_duplicates\" task\n\n### Overview\nPlugin remove \"script\" and \"link\" tags with duplicate \"src\" and \"href\" attributes\n```html\n\u003cscript src=\"1.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"2.js\"\u003e\u003c/script\u003e \n\u003cscript src=\"2.js\"\u003e\u003c/script\u003e\n\u003clink href=\"1.css\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003clink href=\"1.css\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003clink href=\"2.css\" type=\"text/css\" type=\"text/css\"\u003e\n```\nwill become\n```html\n\u003cscript src=\"1.js\"\u003e\u003c/script\u003e\n\u003cscript src=\"2.js\"\u003e\u003c/script\u003e \n\u003clink href=\"1.css\" rel=\"stylesheet\" type=\"text/css\"\u003e\n\u003clink href=\"2.css\" type=\"text/css\" type=\"text/css\"\u003e\n```\nIn your project's Gruntfile, add a section named `remove_duplicates` to the data object passed into `grunt.initConfig()`.\n\n```js\ngrunt.initConfig({\n  remove_duplicates: {\n    options: {\n      keepLast: false\n    },\n    main: {\n      src: 'duplicates.html',\n      dest: 'no_duplicates.html'\n    }\n  },\n});\n```\n\n### Options\n\n#### options.keepLast\nType: `String`\nDefault value: `false`\n\nThis option controls the placement of the remaining script.\nIf this option is set to false then first entry of the script will remain otherwise the last entry will be left\n\n### Usage Examples\n\n#### Default Options\nIn this example, the default options are used to remove duplications from file.\n\n```js\ngrunt.initConfig({\n  remove_duplicates: {\n     main: {\n      src: './test/fixtures/simple.html',\n      dest: './tmp/example.html'\n    }\n  }\n});\n```\n\n#### Multiple files and keep last entry\n\n```js\ngrunt.initConfig({\n  remove_duplicates: {\n    custom_options: {\n        options: {\n          keepLast: true\n        },\n        files: [\n          {cwd: './test/fixtures/', src: './*', dest: 'tmp/', expand: true}\n        ]\n      }\n    }\n  },\n});\n```\n\n## Contributing\nIn lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/).\n\n## Release History\n* 2014-11-05   v0.1.1   Styles duplicates removing\n* 2014-10-25   v0.1.0   Initial upload\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Fgrunt-remove-duplicates","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkomlev%2Fgrunt-remove-duplicates","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkomlev%2Fgrunt-remove-duplicates/lists"}