cheton / browserify-css

A Browserify transform for bundling, rebasing, inlining, and minifying CSS files.
http://cheton.github.io/browserify-css/
MIT License
144 stars 22 forks source link

Custom function `processRelativeUrl` not working for the rules inside `@media` block #35

Closed yuezk closed 8 years ago

yuezk commented 8 years ago

For example.

app.css:

body {
  background-image: url(path/to/bg.png);
}

@media (max-width: 320px) {
  body {
    background-image: url(path/to/bg-sm.png);
  }
}

The problem is the custom function processRelativeUrl is not called for the rules inside the @media block. Relative code is located here. It seems that rules inside @media block are not processed.

When the rule.type is media, it doesn't contain a property called declarations, so the rebase function is not called.

ReworkCSS AST explorer http://iamdustan.com/reworkcss_ast_explorer/

cheton commented 8 years ago

Hi @yuezk,

Sorry for the late response. I'm currently busy on other projects, can you create a pull request for bug fixes if that's fine with you?

yuezk commented 8 years ago

OK, I will fix this.

cheton commented 8 years ago

Added to v0.9.1. Thank you for your assistance.