Exclude *.spec.js files in Rails asset pipeline (application.js)

Viewed 530

I'm attempting to follow John Papa's AngularJs 1.x styleguide (organising tests) and place *.spec.js files (to be executed using Karma) next to client code, which results in files such as some.filter.js and some.filter.spec.js being place next to one another.

However, what I need to avoid, is including the *.spec.js files in the assets pipeline.

The only options I see for now are either avoiding using //= require_tree . in the application.js file and specifying every single file explicitly, or giving up on keeping spec files next to the code.

Is there any better way of achieving the desired behaviour?

(I'm using sprockets 3.5.2 and rails 4.2.6)

2 Answers
Related