{"issue":{"user":{"id":563819,"login":"kamranayub","url":"https://api.github.com/users/kamranayub","gravatar_id":"8303c4eb9f9099df39adbc3d8c634746","avatar_url":"https://secure.gravatar.com/avatar/8303c4eb9f9099df39adbc3d8c634746?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"milestone":null,"created_at":"2011-12-22T21:12:57Z","title":"Cassette does not properly include a bundle for one file","updated_at":"2011-12-22T21:41:09Z","labels":[],"state":"open","id":2641886,"html_url":"https://github.com/andrewdavey/cassette/issues/121","pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"closed_at":null,"number":121,"body":"I ran into an issue that took me awhile to figure out (work around?).\r\n\r\nGiven this file structure:\r\n\r\n```\r\nPublic\r\n - Images\r\n - Themes\r\n - Scripts\r\n   - Vendor\r\n     - jQuery-1.7.1.js\r\n   - App.js\r\n  - base.css\r\n  - layout.css\r\n```\r\n\r\nI create bundles like this:\r\n\r\n```c#\r\nbundles.Add<StylesheetBundle>(\"Public\");\r\nbundles.AddPerSubDirectory<ScriptBundle>(\"Public/scripts\");\r\n```\r\n\r\nThere are two issues:\r\n\r\n1. If I put in a reference inside App.js to \"vendor\" (the bundle), I get an exception that says the vendor path cannot be found.\r\n2. If I try to reference the `public/scripts` folder in `_Layout.cshtml`, it will not include App.js\r\n\r\n```\r\n@{\r\n  Bundles.Reference(\"public/script/vendors\");\r\n  Bundles.Reference(\"public/script\");\r\n}\r\n\r\n// Farther down\r\n@Bundles.RenderScripts()\r\n```\r\n\r\nVendor files are included fine but App.js never gets included.\r\n\r\nI have tried adding each folder manually, or simply removing vendors and only trying to create a bundle for App.js. No approach worked for me.\r\n\r\nWhat ended up \"fixing\" the issue was just directly referencing App.js in the layout:\r\n\r\n    Bundles.Reference(\"public/scripts/app.js\");\r\n\r\nThen it properly included the file. I don't like this simply because now it will not auto-include any new JS files put into that folder.\r\n\r\nIs there any code that says if a bundle contains 1 file, it can't be referenced like that (via parent folder)? I checked _cassette the entire time I ran into this problem, and it *was* detecting app.js and adding it to a bundle:\r\n\r\n```\r\n~/Public/scripts\r\n    app.js\r\n```\r\n\r\nCould it be how the folder structure is laid out? Maybe a path comparison or something is failing when it shouldn't be.\r\n\r\nFor issue 1 above, how are dependencies graphed? Sub-folders first, then top-level folder? Or top-level folder first, then sub-folders? If it's the latter, it's obvious why it failed on App.js (because Vendor bundle wasn't made yet). However, when I made the Vendor bundle first in the configuration, then the top-level-only (using a custom `FileSearch`), it still failed to find the vendor bundle. Not sure what's going on there.\r\n\r\nI just wanted to document what happened to me. Things are working using the above workaround, although I still can't reference anything in app.js.","url":"https://api.github.com/repos/andrewdavey/cassette/issues/121","comments":1,"assignee":null},"comment":{"user":{"id":292014,"login":"andrewdavey","url":"https://api.github.com/users/andrewdavey","gravatar_id":"e774874a8acc65cc0f0bb1e77b4def5b","avatar_url":"https://secure.gravatar.com/avatar/e774874a8acc65cc0f0bb1e77b4def5b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png"},"created_at":"2011-12-22T21:41:09Z","updated_at":"2011-12-22T21:41:09Z","id":3255234,"body":"Thanks for the detailed analysis. Cassette may be getting confused by the stylesheet bundle directory containing the script bundle directories. I have been concerned that overlapping bundles could cause problems.\r\n\r\nYour scenario sounds like an integration test we need to add!\r\n\r\nRe: the first issue. The order of bundle definition shouldn't matter. References external to a bundle are not resolved until all the bundles have been added. Did you also update the in-script references after moving the file?\r\n\r\nIf you're able, please email me a project that reproduces these issues. Or even better a pull request with some failing tests.\r\nThanks! :)","url":"https://api.github.com/repos/andrewdavey/cassette/issues/comments/3255234"},"action":"created"}