{"id":19816695,"url":"https://github.com/welldone-software/gulp-rebase-css-urls","last_synced_at":"2025-07-30T03:37:37.336Z","repository":{"id":30041896,"uuid":"33590992","full_name":"welldone-software/gulp-rebase-css-urls","owner":"welldone-software","description":"Changes the root of all urls in chosen css files","archived":false,"fork":false,"pushed_at":"2016-09-13T06:07:30.000Z","size":12,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-06-09T21:46:47.426Z","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/welldone-software.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}},"created_at":"2015-04-08T07:15:51.000Z","updated_at":"2019-04-30T02:23:36.000Z","dependencies_parsed_at":"2022-06-26T12:31:50.839Z","dependency_job_id":null,"html_url":"https://github.com/welldone-software/gulp-rebase-css-urls","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/welldone-software/gulp-rebase-css-urls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welldone-software%2Fgulp-rebase-css-urls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welldone-software%2Fgulp-rebase-css-urls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welldone-software%2Fgulp-rebase-css-urls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welldone-software%2Fgulp-rebase-css-urls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/welldone-software","download_url":"https://codeload.github.com/welldone-software/gulp-rebase-css-urls/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/welldone-software%2Fgulp-rebase-css-urls/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259546443,"owners_count":22874564,"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-12T10:10:20.597Z","updated_at":"2025-06-12T23:05:37.408Z","avatar_url":"https://github.com/welldone-software.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gulp-rebase-css-urls\n\n\u003e A [Gulp](http://gulpjs.com/) plugin for bundling js and css resources as an external reference.\n\n## Overview\n\nThe plugin is minimalistic and simple. It rebases a chosen css files stream urls to a new base url.\n\n## Example\n\nFor the following folder and file structure:\n\n```\n+ src\n    - file.css\n    + folder1\n        - image.jpg\n        - file2.css\n```\n\nWhere 'file.css' contents are relative to `src`:\n\n```css\n.a{\n    background-image: url(\"folder1/image.jpg\");\n}\n```\n\nand 'file2.css' contents are relative to `folder1`:\n\n```css\n.b{\n    background-image: url(\"image.jpg\");\n}\n```\n\nAnd the task:\n\n```js\nvar srcDir = 'src',\n    destDir = 'dest',\n    rebaseCssUrls = require('gulp-rebase-css-urls'),\n    concat = require('gulp-concat');\n\ngulp.task('concat-css-files', ['copy-image-file'], function(){\n    return gulp.src(srcDir + '/**/*.css')\n        .pipe(rebaseCssUrls(srcDir)) //this makes .b's background-image url relative to srcDir\n        .pipe(concat('bundle.css'))\n        .pipe(gulp.dest(destDir));\n});\n```\n\nSo the results in the destination directory looks like this:\n\n```\n+ dest\n    - bundle.css\n    + folder1\n        - image.jpg\n```\n\nWith the bundle.css contents like so:\n\n```css\n.a{\n    background-image: url(\"folder1/image.jpg\");\n}\n.b{\n    background-image: url(\"folder1/image.jpg\");\n}\n```\n\nNotice how both `.a` and `.b`'s URLs are relative and based on the same base.\n\n## Parameters\n\n`rebaseCssUrls(base)`\n\n### base\nType: `String`\n\nThe new base url, comparing to initial file's src.\n\n## Testing\nRunning the gulp file would concat `tests/input` files into `tests/actual` and compare the results to a static `tests/expected` directory, and make sure we got what we've expected.\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 [Gulp](http://gulpjs.com/).\n\n## Release History\n - 0.0.1 - Basic features.\n - 0.0.2 - Improved tests and added reporting.\n\n## License\n[MIT](https://github.com/welldone-software/gulp-bundle-file/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwelldone-software%2Fgulp-rebase-css-urls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwelldone-software%2Fgulp-rebase-css-urls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwelldone-software%2Fgulp-rebase-css-urls/lists"}