{"action":"reopened","issue":{"url":"https://api.github.com/repos/systemjs/builder/issues/220","labels_url":"https://api.github.com/repos/systemjs/builder/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/systemjs/builder/issues/220/comments","events_url":"https://api.github.com/repos/systemjs/builder/issues/220/events","html_url":"https://github.com/systemjs/builder/issues/220","id":93402091,"number":220,"title":"separateCSS option does not work with bundle arithmetic.","user":{"login":"mikol","id":377413,"avatar_url":"https://avatars.githubusercontent.com/u/377413?v=3","gravatar_id":"","url":"https://api.github.com/users/mikol","html_url":"https://github.com/mikol","followers_url":"https://api.github.com/users/mikol/followers","following_url":"https://api.github.com/users/mikol/following{/other_user}","gists_url":"https://api.github.com/users/mikol/gists{/gist_id}","starred_url":"https://api.github.com/users/mikol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikol/subscriptions","organizations_url":"https://api.github.com/users/mikol/orgs","repos_url":"https://api.github.com/users/mikol/repos","events_url":"https://api.github.com/users/mikol/events{/privacy}","received_events_url":"https://api.github.com/users/mikol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-06T23:41:44Z","updated_at":"2015-07-09T11:05:55Z","closed_at":null,"body":"For example, consider `builder.build('main + a.css + b.css', 'out.js')` with `builder.config({ separateCSS: true })`. If `main` further depends on `c.css`, we would expect `out.css` to contain `a.css`, `b.css`, and `c.css`. What `out.css` actually contains is only `c.css`.\r\n\r\nI believe this is due to two factors. First, [the `metadata.bundle` check in `traceModule`](https://github.com/systemjs/builder/blob/master/lib/builder.js#L337-L346) doesn’t extract the right components from the bundle equation so `a.css` and `b.css` are never included in the bundle. If this check is commented out and the code simply falls through to the current `else` block, then `a.css` and `b.css` will be handed off to the CSS plugin for processing.\r\n\r\nHowever, this is where the second factor comes in. The CSS plugin will process `a.css` and `b.css` together, but `c.css` is handled separately. The result is that `c.css` overwrites the existing `a.css + b.css` bundle and therefore `out.css` again only contains `c.css`."}}