-
Notifications
You must be signed in to change notification settings - Fork 48
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
Enhancement: change compilation levels for certain files. #13
Comments
Ok going to submit a PR for this... but first let's agree on an API: I'm using advanced compilation, and only need one file compiled with the simple option, so this is the api I started writing: grunt.initConfig({
'closure-compiler': {
frontend: {
js: manifest.background.scripts,
simple: ['node_modules/twitter-text/twitter-text.js'],
jsOutputFile: 'compiled/background.cc.js',
maxBuffer: 500,
options: {
'compilation_level': 'ADVANCED_OPTIMIZATIONS',
'language_in': 'ECMASCRIPT5_STRICT',
'externs': require('fs').readdirSync('./build/cc-externs')
}
}
}
}); Now, I could see how someone would mostly use simple compilation and want advanced compilation for a few files where possible. So we could make an identical option to my |
To be honest, I prefer to keep this tool as simple as possible. What's great with Grunt is that you can actually automatize such tasks. And of course, the other way would be to contribute advanced optimizations compatible versions of your dependencies. |
How could I basically say... grunt.runMoreStuff({
'closure-compiler': {
frontend: {
js: manifest.background.scripts,
jsOutputFile: 'compiled/background.cc.js',
maxBuffer: 500,
options: {
'compilation_level': 'ADVANCED_OPTIMIZATIONS',
'language_in': 'ECMASCRIPT5_STRICT'
}
}
}
}); Any idea? |
You should probably do something like this: grunt.initConfig({
'closure-compiler': {
advanced: {
js: manifest.background.scripts,
jsOutputFile: 'compiled/background.cc.js',
options: {
'compilation_level': 'ADVANCED_OPTIMIZATIONS'
}
},
simple: {
js: manifest.api.scripts,
jsOutputFile: 'compiled/api.cc.js',
options: {
'compilation_level': 'SIMPLE_OPTIMIZATIONS'
}
},
}
}); Then, find or develop a task to concatenate |
In trying to successfully use advanced compilation for a project but one of my dependencies flat out breaks when I use advanced compilation, and there's not much I can swiftly do about it. I can use advanced compilation on my stuff just fine, but need to use simple compilation for my other dependency.
Not an easy thing to do my any means, but I just wanted to write it down somewhere relevant.
The text was updated successfully, but these errors were encountered: