{"id":16485789,"url":"https://github.com/creeperyang/sourcemap-updater","last_synced_at":"2026-05-14T06:32:02.134Z","repository":{"id":66339881,"uuid":"78119721","full_name":"creeperyang/sourcemap-updater","owner":"creeperyang","description":"Help to update source map when modifying css","archived":false,"fork":false,"pushed_at":"2017-01-06T14:01:26.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-01T00:12:06.091Z","etag":null,"topics":["css","sourcemap-updater","sourcemaps"],"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/creeperyang.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":"2017-01-05T14:26:21.000Z","updated_at":"2017-01-05T15:48:39.000Z","dependencies_parsed_at":"2023-02-23T04:00:36.453Z","dependency_job_id":null,"html_url":"https://github.com/creeperyang/sourcemap-updater","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/creeperyang/sourcemap-updater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creeperyang%2Fsourcemap-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creeperyang%2Fsourcemap-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creeperyang%2Fsourcemap-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creeperyang%2Fsourcemap-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creeperyang","download_url":"https://codeload.github.com/creeperyang/sourcemap-updater/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creeperyang%2Fsourcemap-updater/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33013233,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["css","sourcemap-updater","sourcemaps"],"created_at":"2024-10-11T13:27:13.436Z","updated_at":"2026-05-14T06:32:02.119Z","avatar_url":"https://github.com/creeperyang.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sourcemap-updater\n\n[![Build Status](https://travis-ci.org/creeperyang/universal-css-processor.svg?branch=master)](https://travis-ci.org/creeperyang/universal-css-processor)\n\n\u003e A tool help to modify css and update sourcemap automatically.\n\nAssume that you have a css (maybe generated via `sass/postcss`) and a corresponding sourcemap. If you want to modify the css (such as delete one declaration, change a prop value), you could modify directly, but the sourcemap would be inaccurate.\n\nThis lib will help you modify css (more convenient/powerful), and  update sourcemap automatically. This means you no longer need to care about sourcemap when you modify css.\n\n## Installation and Usage\n\n```bash\nnpm i --save sourcemap-updater\n```\n\nAnd then\n\n```js\nconst update = require('sourcemap-updater')\n\nconst res = update([\n    readFileSync(`${__dirname}/res/concated.css`),\n    readFileSync(`${__dirname}/res/concated.css.map`)\n], {\n    updater (str, node, type) {\n        // for `prop-value`s, remove all newline of value.\n        if (!type \u0026\u0026 node \u0026\u0026 node.prop) {\n            node.value = node.value.replace(/\\s*\\n\\s*/g, '')\n            return node.toString() + ';'\n        }\n        return false\n    }\n})\n\nwriteFileSync(`${__dirname}/res/concated.css`, res.css)\nwriteFileSync(`${__dirname}/res/concated.css.map`, res.map)\n```\n\n## API\n\n**`update(data[, options])`**\n\n- `data` is `Array`, `data[0]` is css content (`String/Buffer`), and `data[1]` is original sourcemap (`String/Buffer/Object`).\n- `options` is `Object`. And `options.updater` is `Function`, `options.file` is `String`\n\n    `options.updater` is like `function(str, node, type){}`, is the same as [`postcss/builder`](http://api.postcss.org/global.html#builder). You can use it to change css. For the return value of the func:\n        \n        1. If you return `false`, this part string would keep the same.\n        2. If you return `String`, this `string` will be used (as the replacement).\n        3. Otherwise, this part string will be deleted.\n    \n    `options.file` is `String`, the relative file path of the css content. It will be used when original sourcemap is invalid.\n\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreeperyang%2Fsourcemap-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreeperyang%2Fsourcemap-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreeperyang%2Fsourcemap-updater/lists"}