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

Add sourcemaps on ClosureCompilerFilter #815

Closed

Conversation

ciotto
Copy link

@ciotto ciotto commented Jan 11, 2017

In order to use opbeat-plain-JS to track JavaScript errors, I added a few features for sourcemaps files creation using the ClosureCompilerFilter.

I also add some test for this part.

@karyon
Copy link
Contributor

karyon commented Jan 12, 2017

please help me understand this. this PR

  1. Adds OFFLINE_GROUP_FILES that enables/disables concatenation of files in offline mode (this is what you mean by grouping, right?)
    • It does not add this feature for "online" compression, right?
    • what is the use case for this setting? is not concatenating files a requirement for source maps?
  2. Adds CLOSURE_COMPILER_SOURCEMAPS which makes the closure compiler generate source maps
  3. Adds OFFLINE_SOURCEMAPS_ON_FILES
    • this i don't quite get. do source maps work without making this true? what's the benefit of encoding this in base64 instead of a normal .map file?

@ciotto
Copy link
Author

ciotto commented Jan 18, 2017

Hello,
I try to explain:

  1. I probably used the wrong name for variable, I did a check and if OFFLINE_GROUP_FILES is False, the concatenation of files is disabled also in "on-line" mode. The correct name can be ENABLE_FILES_CONCATENATION. I added this function becouse, for the flow of compressor, I can't minify more files in one Closur Compiler call, so I can't generate a single .map file for more files.

  2. Correct

  3. This appear to work also in "on-line" mode, so i used the wrong name. I used the base64 min because the SASS precompiler used this before and because I can't generate the file in the filter, but base64 source map is not largely supported and is not good for download size

Now I use this code in production an it work fine.

I will change the variables names as sun as possible.

@karyon
Copy link
Contributor

karyon commented Aug 22, 2017

ref #438.

closing due to inactivity.

as far as i can see (correct me if i'm wrong), this PR makes the clojure compiler output sourcemaps into files, appends that as a base64 data url to the js file, and then decodes the base64 data, writes it to a file, and replaces the data url with a url pointing to that file. i think this is the wrong approach, a better one would make the compiler put the source map more directly into the storage.

having said that, i would appreciate any new attempt at this, although i'm still not sure how we should handle the different supported compilers, e.g. the default rjsmin doesn't even support sourcemaps.

@karyon karyon closed this Aug 22, 2017
@ciotto
Copy link
Author

ciotto commented Aug 22, 2017

I'm sorry for my inactivity, but, even though I use this code in production, I opted for a more usable approach, so I don't spent other time on this develop.

Surely my approach is not the best but, if I remember, CosureCompiler can't write source maps in a separated file. Anyhow, write directly on a storage require a big refactor of the Compressor's logics.

In other words, this is a workaround but work for my purpose.

@karyon
Copy link
Contributor

karyon commented Aug 22, 2017

yeah, "require a big refactor" would also be my first guess. however, django-compressor is quite complex and hard to maintain as it is, and bolting on more workarounds will only worsen this :)

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

Successfully merging this pull request may close these issues.

None yet

2 participants