Giter Site home page Giter Site logo

Comments (13)

btsai avatar btsai commented on May 28, 2024 2

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.

SebastianZaha avatar SebastianZaha commented on May 28, 2024

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.

kimardenmiller avatar kimardenmiller commented on May 28, 2024

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.

mgenereu avatar mgenereu commented on May 28, 2024

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.

kimardenmiller avatar kimardenmiller commented on May 28, 2024

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.

kkirsche avatar kkirsche commented on May 28, 2024

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.

mgenereu avatar mgenereu commented on May 28, 2024

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.

kimardenmiller avatar kimardenmiller commented on May 28, 2024

Sounds interesting. Thanks for offering to share that outcome 😄

from karma-sprockets.

mgenereu avatar mgenereu commented on May 28, 2024

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.

kimardenmiller avatar kimardenmiller commented on May 28, 2024

Yes, pointing to a gist from here might be perfect.

from karma-sprockets.

tylercollier avatar tylercollier commented on May 28, 2024

@mgenereu, did you finish that gist?

from karma-sprockets.

jrolfs avatar jrolfs commented on May 28, 2024

@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.

kimardenmiller avatar kimardenmiller commented on May 28, 2024

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 photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.