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

preseveLicenseComments does not work with wrap #132

Closed
mikaelkaron opened this issue Mar 27, 2012 · 2 comments
Closed

preseveLicenseComments does not work with wrap #132

mikaelkaron opened this issue Mar 27, 2012 · 2 comments
Milestone

Comments

@mikaelkaron
Copy link
Contributor

have a license file (let's say header.txt) where I've compressed the licenses from all my modules into one.

/*!
...
 * This is the optimized build that have license headers removed
 * to save some bandwidth.
 *
 * Full description and individual module sources and licenses are
 * available at https://github.com/someUser/someProject
 /*

I expect to be able to node r.js -o baseUrl=../src/js out=file.js preserveLicenseComments=false wrap.startFile=header.txt wrap.endFile=footer.txt to strip all the original license comments, but still add my own in the top, but for me the contents from header.txt is stripped to.

@jrburke
Copy link
Member

jrburke commented Mar 29, 2012

Assigning for consideration in 1.1. In the meantime, you could use the onBuildWrite to work around this behavior: in the onBuildWrite, if it is not the wrap file, strip out the comments manually. See this article for info on onBuildWrite:

http://www.ericfeminella.com/blog/2012/03/24/preprocessing-modules-with-requirejs-optimizer/

@jrburke
Copy link
Member

jrburke commented May 24, 2012

Looking more at it, onBuildWrite will not work, and the license comment trimming happens as part of the full file optimizations, where pragmas and also minification is done. So this will not be able to be supported. the best thing to do is to use a post-r.js build step to add the header back after final optimizations.

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