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

options for compiling vs options for checking dependencies #38

Open
jeromegn opened this issue Jan 19, 2015 · 3 comments
Open

options for compiling vs options for checking dependencies #38

jeromegn opened this issue Jan 19, 2015 · 3 comments

Comments

@jeromegn
Copy link

It so happens that browserify-rails uses the same CLI options for checking the dependencies and actually compiling the file.

  • -d is not necessary when checking dependencies
  • --list is not necessary when compiling the end file

I noticed the issue since I was trying to use minifyify as a plugin. I added the CLI arguments for it. The plugin crashes since it doesn't get the source map when browserify-rails is checking for dependencies (I honestly have no idea why). I modified the gem locally to add compile_commandline_options that are only applied when run_browserify is called for compilation. It's most likely a wrong implementation, it was only meant to be a test. It worked.

I'm not sure how best to do the distinction. Some transforms like CoffeeScript compilation are quite useful every time browserify will be ran within the browserify-rails process (or else it might crash).

@cymen
Copy link
Member

cymen commented Jan 19, 2015

Yes, I think this causes problems sometimes passing the same arguments to both. I thought this was my problem when trying to use a transform but it turned out to be unrelated. However, it is going to make configuration tricky.

Stepping back, using minifyify at the browserify level when using Rails probably doesn't make sense. That kind of processing should be hooked up later in the asset pipeline and it would be used when you generate the static assets (rake assets:precompile) for production. Does that make sense? It should be possible to do but given we are in Rails, it might not make sense.

@jeromegn
Copy link
Author

I'm fine with using a different solution. I definitely thought about it.

However, minifyify buys you a lot. There's definitely complexity involved into:

  • extracting the original source map
  • uglifying the code
  • applying extracted original source map on top of the minified source map
  • saving that source map elsewhere

I'd be happy to hear your solution (and maybe what I was describing is not really an issue).

@cymen
Copy link
Member

cymen commented Jan 19, 2015

I think we should get it to work. For my project, in development, I want source maps and don't care about asset size. For production, I do not want source maps and am worried about asset size. This other issue has a little more details on Rails 4 and asset compilation:

#36

I think we should get what you want to work. I'm still thinking over how to do it well.

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

No branches or pull requests

2 participants