{"action":"created","issue":{"url":"https://api.github.com/repos/josh/sprockets-es6/issues/18","labels_url":"https://api.github.com/repos/josh/sprockets-es6/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/josh/sprockets-es6/issues/18/comments","events_url":"https://api.github.com/repos/josh/sprockets-es6/issues/18/events","html_url":"https://github.com/josh/sprockets-es6/issues/18","id":65568371,"number":18,"title":"require directive and non-es6 assets","user":{"login":"chancancode","id":55829,"avatar_url":"https://avatars.githubusercontent.com/u/55829?v=3","gravatar_id":"","url":"https://api.github.com/users/chancancode","html_url":"https://github.com/chancancode","followers_url":"https://api.github.com/users/chancancode/followers","following_url":"https://api.github.com/users/chancancode/following{/other_user}","gists_url":"https://api.github.com/users/chancancode/gists{/gist_id}","starred_url":"https://api.github.com/users/chancancode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chancancode/subscriptions","organizations_url":"https://api.github.com/users/chancancode/orgs","repos_url":"https://api.github.com/users/chancancode/repos","events_url":"https://api.github.com/users/chancancode/events{/privacy}","received_events_url":"https://api.github.com/users/chancancode/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-03-31T23:30:22Z","updated_at":"2015-04-08T02:26:32Z","closed_at":"2015-04-08T02:17:27Z","body":"I was just trying this out this morning. I found this in the readme:\r\n\r\n> Requires asset manifests for precompiling\r\n> \r\n> .es6 won't work directly with config.assets.precompile = %w( foo.es6 ) for annoying compatibility\r\n> reasons with Sprockets 2.x. Besides, you should look into moving away from config.assets.precompile > and using manifests instead. See Sprockets 3.x UPGRADING guide.\r\n\r\nSo, I added `app/manifest.js` and got that working (need a custom patch from @lucasmazza to make that working. Something like this:\r\n\r\n```javascript\r\n// app/manifest.js\r\n//\r\n//= link ./javascripts/application.es6\r\n// ...\r\n```\r\n\r\n```javascript\r\n// app/javascripts/application.es6\r\n//\r\n//= require jquery\r\n// ...\r\n```\r\n\r\n...which is what the README suggested, if I understood it correctly. However, while I was able to get `application.es6` precompiled as expected, it couldn't find `jquery` from the require directive, because it is looking for something with the ES6 MIME type.\r\n\r\nI ended up having to rename `application.es6` to `application.js`, which works (and I was able to require es6 dependencies from there), but it's kind of odd that I ended up having two manifest-looking things that has to be in `.js` extension.\r\n\r\n1. Is this expected? Should we update the README to clarify it is the \"root\" file that you compile (whether through `config.assets.precompile` or through a manifest file) that has to be in `.js`?\r\n2. Can we make this work?\r\n"},"comment":{"url":"https://api.github.com/repos/josh/sprockets-es6/issues/comments/90783686","html_url":"https://github.com/josh/sprockets-es6/issues/18#issuecomment-90783686","issue_url":"https://api.github.com/repos/josh/sprockets-es6/issues/18","id":90783686,"user":{"login":"josh","id":137,"avatar_url":"https://avatars.githubusercontent.com/u/137?v=3","gravatar_id":"","url":"https://api.github.com/users/josh","html_url":"https://github.com/josh","followers_url":"https://api.github.com/users/josh/followers","following_url":"https://api.github.com/users/josh/following{/other_user}","gists_url":"https://api.github.com/users/josh/gists{/gist_id}","starred_url":"https://api.github.com/users/josh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/josh/subscriptions","organizations_url":"https://api.github.com/users/josh/orgs","repos_url":"https://api.github.com/users/josh/repos","events_url":"https://api.github.com/users/josh/events{/privacy}","received_events_url":"https://api.github.com/users/josh/received_events","type":"User","site_admin":true},"created_at":"2015-04-08T02:26:32Z","updated_at":"2015-04-08T02:26:32Z","body":"> Should we document that somewhere?\r\n\r\nFor sure, I'd love to get more docs everywhere :wink: \r\n\r\n> (or, if we can make //= link ./javascripts/foo.js automagically work, that would be even nicer)\r\n\r\nDid you mean `./javascripts/application.es6`?\r\n\r\nThe link stuff is special in that is doesn't inherit the content of the file you're in. By happy conscience `//= require ./javascripts/application.es6` should work inside an `.js` file since the `application/javascript` content type overrides whatever extension you passed to require. Sense only `application/javascript` can be combined with other `application/javascript`. You wouldn't concat a `foo.js` and foo.coffee` as is.\r\n\r\nBut linking doesn't inherit the current asset content type. This way you can link to an image from a css file. Or link to css from a js file. They aren't being combined so thats fine. The extension that you use is significant since you can now do `link foo.png` where foo.svg exists on disk and that could be transformed into a png.\r\n\r\nI think everything is working correctly here, but I bet we could improve the error message. For the es6 example, I think its happening because its trying to concat a .js to an .es6 file and return .es6. That should be pretty detectable and easy to suggest what went wrong."}}