-
Notifications
You must be signed in to change notification settings - Fork 1.2k
declare a source file even when passing in a string #324
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
Conversation
@mishoo would you mind taking a look at this PR? |
+1 Note this is a duplicate of #294 Happy for either one to be included. Just really need this functionality. |
we too are using a fork, but would much rather use the mainline branch here. @mishoo if there are any iterations i could do on this PR, please let me know. i'm happy to work on this and see it through. |
ping |
Without reading through all of the pull requests, I made my own, but I'm impartial as to which one gets merged in. Seems like it's been a while since anyone has looked at this. Many task runners could really take advantage of this functionality. Since uglify is one of the more common build tasks in web development, I recommend this become a priority. Let me know how I can help. |
what we ended up doing is just not calling minify directly from uglify and instead used the custom minify function that is inside this PR. luckily the function is small, so we can maintain it for now. but yes, it would be nice to just have this in the library itself. |
Sounds like a good idea. Did you have to account for all of the other options that can affect the output after that as well? |
Something else I've had to do is be able to take in a source map as a string (coffeescript generated source map). I've got it on my fork. When I see @mishoo spend a bit more time here on uglify, I'll send a PR. He seems to be pretty occupied with angular-kendo (understandably). |
yes, we do have to account for other options that we may want to pass in that affect output. so instead of calling
we now call
and this is what UglifyMinifyPatch looks like
|
Sorry for ignoring this for so long. However, I don't like what this API becomes. What if we support an array of objects as first argument to UglifyJS.minify? Then we can ditch UglifyJS.minify([
{ filename: "...",
content: "...", // optional
inSourceMap: "..." }
]); |
i like that API as well |
+1 on that. Anyone planning on implementing? I would be more than happy to, I just don't want to open up a pull request if someone is already going to work on it. |
i won't be working on it, so i'll close this PR to indicate that. |
when generating source maps by using the
fromString=true
in theUglify.minify
options, the source map contains a problematic array for the sources fieldthus, the source map can't be used because i can't point it at the original source. however, if i do not use a string directly but the filename itself, the source map feature works.
this pull request adds a
fromFile
option that can either be an array of filenames or just a single string filename to properly match up if just a single string of source code is passed in, or an array of source code.so the following approaches now produce good source maps
and