Open kimardenmiller opened 10 years ago
Sadly only js files that are local to your project are supported right now. Including js files from gems does not work. This plugin uses https://github.com/lucaong/sprockets-chain , this limitation would be best addressed there, but I am not sure if it is possible.
Thanks for the follow thru 😃 /k
On Aug 28, 2014, at 12:09 AM, Sebastian Zaha notifications@github.com wrote:
Sadly only js files that are local to your project are supported right now. Including js files from gems does not work. This plugin uses https://github.com/lucaong/sprockets-chain , this limitation would be best addressed there, but I am not sure if it is possible.
— Reply to this email directly or view it on GitHub.
I use rake to compile my application.js (with erb and gem dependencies) and then include my angular app using this (no erb or gem dependencies).
Thanks, @mgenereu
My use case is for Karma testing. Compiling assets seems to create one big application.js. That does not allow me to change js code and run tests against that, TDD.
Is your use case different?
I'm getting the same issue. I want to include my angular app and it's dependencies (all in /app/assets/javascripts/) then build the applicaiton.js which will load it all together and then inject that into Karma. I'm not having any luck getting this to work though
Tomorrow we're splitting the gem and erb sprockets to be compiled by Rails and the Angular coffee sprockets compiled by Karma. That way, updates to the Angular stuff will be tested in realtime. I'll document here how that goes.
Sounds interesting. Thanks for offering to share that outcome :smile:
It worked out great. I need to track all the Rails changes and post them somewhere. I don't have a blog. Would this be a good use of a gist??
Yes, pointing to a gist from here might be perfect.
@mgenereu, did you finish that gist?
@tylercollier @kimardenmiller not sure if you are still interested, but I solved this problem in our application with this rake task: https://gist.github.com/jrolfs/8bfe66931fe2dd293732.
It depends on rake-hooks and sprockets-standalone.
Unfortunately for now you'll need to list your "gem assets" out manually as you can see. This is not a problem for our application because there are only 10 and we won't likely be adding any more so I haven't bothered investigating automating that part yet although it's probably possible by doing some matching on Rails.application.config.assets.paths
.
The task outputs compiled JS to app/assets/gems/javascripts
.
Jamie,
Thanks so much. We’ll take a look at that :-)
/k
On Apr 23, 2015, at 10:09 AM, Jamie Rolfs notifications@github.com wrote:
@tylercollier https://github.com/tylercollier @kimardenmiller https://github.com/kimardenmiller not sure if you are still interested, but I solved this problem in our application with this rake task: https://gist.github.com/jrolfs/8bfe66931fe2dd293732 https://gist.github.com/jrolfs/8bfe66931fe2dd293732.
It depends on rake-hooks https://github.com/guillermo/rake-hooks and sprockets-standalone https://github.com/jgraichen/sprockets-standalone.
Unfortunately for now you'll need to list your "gem assets" out manually as you can see. This is not a problem for our application because there are only 10 and we won't likely be adding any more so I haven't bothered investigating automating that part yet although it's probably possible by doing some matching on Rails.application.config.assets.paths.
The task outputs compiled JS to app/assets/gems/javascripts.
— Reply to this email directly or view it on GitHub https://github.com/SebastianZaha/karma-sprockets/issues/4#issuecomment-95656823.
I banged my head against the wall with karma-sprockets for at least an hour until I dug deep into the code.
It looks like you have to do the following declaration in your karma.conf.js file also:
frameworks: [
'jasmine',
'sprockets'
],
Until I did that, karma-sprockets was ignoring all of the js requires.
Installed as instructed and edited karma.conf.js:
But assets do not appear to be available. Should be available as if they were specified under
files:
Does it matter if the asset is under .rvm? What about erb files?
/Users/kimardenmiller/.rvm/gems/ruby-2.1.1@spokenvote/gems/angular-rails-templates-0.1.1/vendor/assets/javascripts/angular-rails-templates.js.erb