Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable --skip-rebase #88

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ clean-css-cli 4.0 introduces some breaking changes:
--source-map Enables building input's source map
--source-map-inline-sources Enables inlining sources inside source maps
--with-rebase Enables URLs rebasing
--skip-rebase Disables URLs rebasing
```

## Compatibility modes
Expand Down Expand Up @@ -423,7 +424,7 @@ which sets all units rounding precision to 3 digits except `px` unit precision o

## How to rebase relative image URLs?

clean-css-cli will rebase paths it automatically for you when full paths to input files are passed, and `--with-rebase` & `--output` options are used, e.g
clean-css-cli will rebase paths automatically for you when full paths to input files are passed, and `--with-rebase` & `--output` options are used, but not if `--skip-rebase` is used, e.g

```css
/*! one.css */
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function cli(process, beforeMinifyCallback) {
.option('--source-map', 'Enables building input\'s source map')
.option('--source-map-inline-sources', 'Enables inlining sources inside source maps')
.option('--with-rebase', 'Enable URLs rebasing')
.option('--skip-rebase', 'Disable URLs rebasing')
.option('--watch', 'Runs CLI in watch mode');

program.on('--help', function () {
Expand Down Expand Up @@ -124,7 +125,7 @@ function cli(process, beforeMinifyCallback) {
fs.mkdirSync(options.output, {recursive: true});
}

if (inputOptions.withRebase && ('output' in inputOptions) && inputOptions.output.length > 0) {
if (inputOptions.withRebase && ('output' in inputOptions) && inputOptions.output.length > 0 && !inputOptions.skipRebase) {
if (isDirectory(path.resolve(inputOptions.output))) {
options.rebaseTo = path.resolve(inputOptions.output);
} else {
Expand Down