Comments (13)
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.
from karma-sprockets.
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.
from karma-sprockets.
Thanks for the follow thru 😃
/k
On Aug 28, 2014, at 12:09 AM, Sebastian Zaha [email protected] 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.
from karma-sprockets.
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).
from karma-sprockets.
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?
from karma-sprockets.
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
from karma-sprockets.
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.
from karma-sprockets.
Sounds interesting. Thanks for offering to share that outcome 😄
from karma-sprockets.
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??
from karma-sprockets.
Yes, pointing to a gist from here might be perfect.
from karma-sprockets.
@mgenereu, did you finish that gist?
from karma-sprockets.
@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
.
from karma-sprockets.
Jamie,
Thanks so much. We’ll take a look at that :-)
/k
On Apr 23, 2015, at 10:09 AM, Jamie Rolfs [email protected] 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 #4 (comment).
from karma-sprockets.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from karma-sprockets.