rotundasoftware / parcelify

Add css to your npm modules consumed with browserify.
MIT License
251 stars 20 forks source link

feature request: appTransformDirs with recurse enabled #27

Closed alessioalex closed 9 years ago

alessioalex commented 9 years ago
appTransformDirs (default: undefined) - appTransforms are applied to any packages that are within one of the directories in this array. (The recursive search is stopped on node_module directories.)

Hi,

I would like to have the recursion enabled (and not stopped when it sees 'node_modules' in the path) and it would be nice to be allowed to do that. The scenario is the following: I have some modules installed that I would like to reused across multiple applications and those need to be installable from NPM / another source. Without the recursion enabled I cannot do that.

This is just a matter of including an option and making a simple check (+ tests && updating CLI + docs of course). I can do that myself, I would just like to have your confirmation on this subject. Without this feature I really cannot use parcelify unfortunately.

Let me know what you think.

Best, Alex

dgbeck commented 9 years ago

Hi Alex! Thanks for the question / request.

It sounds like the functionality you are looking for can be achieved through package specific transforms. Once you start sharing packages between applications it is best to include the transform as part of the package itself, instead of relying on the global appTransforms to be setup correctly.

Let me know if that doesn't solve your issue.

Thanks!

alessioalex commented 9 years ago

@dgbeck thanks so much for the feedback, that actually solves my problem.

I'll try to contribute to the documentation && examples when I can so I can make it easier for other people as well.

parcelify will make my life much easier :+1:

alessioalex commented 9 years ago

hey @dgbeck it seems that after updating to v1 the packageTransform function is gone. Without that functionality I cannot enforce a certain transform to modules from node_modules. Maybe now it's a good time to re-open this ticket?

My use case is the following: I want to use enforce a certain transform to all the modules, without the need of adding that local transform there.

dgbeck commented 9 years ago

Hi @alessioalex!

Good news, I think. You should be able to use browserify's packageFilter option, which is the same as the old packageTransform parcelify option

var b = browserify( { packageFilter : function( pkg, dirPath ) { ... // return modified pkg } );
var p = parcelify( b );
alessioalex commented 9 years ago

@dgbeck you're the man! :+1: btw where is this option coming from? couldn't find it in the browserify docs / code so far.

alessioalex commented 9 years ago

ah it's from https://www.npmjs.com/package/module-deps

thanks again, it worked fine.