Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

fix(useminPrepare): rewrite relative CSS urls #567

Closed
wants to merge 1 commit into from

Conversation

jridgewell
Copy link
Contributor

First, tell useminPrepare to only 'cssmin' our CSS files (dropping the
concat task). See yeoman/grunt-usemin#225.
Second, tell cssmin to rewrite relative urls to be relative to our app
directory.

This is particularly useful for bower install components that have CSS
files that reference relative urls. ie.

.
├── app
│   └── bower_components
│       └── component
│           ├── images
│           │   └── image.png
│           └── style.css
└── build
body {
background: url('images/image.png');
}

Will have now properly rewrite it's image url to

body {
background: url('bower_components/component/images/image.png');
}

First, tell useminPrepare to only 'cssmin' our CSS files (dropping the
concat task). See yeoman/grunt-usemin#225.
Second, tell cssmin to rewrite relative urls to be relative to our app
directory.

This is particularly useful for bower install components that have CSS
files that reference relative urls. ie.

```
.
├── app
│   └── bower_components
│       └── component
│           ├── images
│           │   └── image.png
│           └── style.css
└── build
```

```
body {
background: url('images/image.png');
}
```

Will have now properly rewrite it's image url to
```
body {
background: url('bower_components/component/images/image.png');
}
```
@passy passy closed this in 661a6d6 Feb 10, 2014
@passy
Copy link
Member

passy commented Feb 10, 2014

Just tested this, works a treat. Thanks, @jridgewell!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants