Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pipe preprocessors #36

Closed
ouhouhsami opened this issue Oct 15, 2014 · 4 comments
Closed

pipe preprocessors #36

ouhouhsami opened this issue Oct 15, 2014 · 4 comments
Labels

Comments

@ouhouhsami
Copy link

Hello,

I tried karma-bro and it occurs that if I use

preprocessors: {
        'src/index.js': ['other-preprocessor', 'browserify']
    }

the file returned by browserify preprocessor is not the one processed by other-preprocessor but the original file src/index.js browserified.

Have you ever had this use case? (in my case, 'other-preprocessor' is a es6-transpiler).

Cheers,

@bendrucker
Copy link
Collaborator

You'll need to use a browserify transform rather than a preprocessor

https://github.com/thlorenz/es6ify

@ouhouhsami
Copy link
Author

Ok Ben, thanks for you answer.
But could you explain me why browserify preprocessor don't work as a pipe? (it's also the case with other karma browserify preprocessors)
Also, the link you gave me use traceur, and I use es6-transpiler. Anyway, I'll take a close look at this.

Cheers

@bendrucker
Copy link
Collaborator

Seems like es6-browserify should work fine.

Preprocessors can normally be chained but the way karma-bro works is a bit of a hack. It has to insert a bundle file as a framework, but Karma does not give frameworks the ability to perform async operations. So instead it needs to insert a shim file that later is added to the karma files array and later receives the bundled code. It also reads the files directly versus grabbing Karma's representation of them.

@bendrucker
Copy link
Collaborator

This will hold, by the way, for anything you want to change with your code. Once you're using Browserify, you need to use transforms. If you wanted to use Istanbul, for example, you'd use a transform and not a preprocessor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants