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
create a build command to export packages as globals #85
Comments
Browserify 2 can export globals with the -s (--standalone) option. |
see also global-wrap |
amdclean almost works, they just need to fix a couple bugs (gfranko/amdclean#8, gfranko/amdclean#10) or we need to change our code a little bit. |
just tried global-wrap and it works! require('global-wrap')({
main: 'node_modules/mout/index.js',
global:'mout'
}, function(err, out){
require('fs').writeFileSync('mout.js', out);
}); in the end, the format they use is very similar to AMD, don't even know why they did not decide to use the AMD simplified CJS as the transport format; but at least it exposes a single global and is automatic. maybe we should use any of these approaches on a future release, not that I care too much about users that are using globals (everyone should be using modules nowadays!!!) |
grunt-mout can be used to generate custom browserify builds exported to the |
Is it possible to inject an object getter for each modules for the dev version to log which modules have been used and then the user can generate the custom build with that result without manually look for which modules had been used? |
Like a dry run with informative logging output? Or would the file be
|
Or you mean actual code that logs which pieces they use because they
|
@edankwan I added support for spying on your app's usage of First generate a spyable grunt.initConfig({
mout: {
dist: {
options: {
spy: true
},
dest: './.tmp/mout.js'
}
}
}); Then load the generated Open up your console and run You can copy paste that list into the grunt config to create your slimmer If grunt.initConfig({
mout: {
dist: {
options: {
modules: [
'mout/array/contains',
'mout/object/get'
]
},
dest: './.tmp/mout.js'
}
}
}); |
I've been wanting this for awhile. Mostly for prototype stuff. 👍 guys. |
@jmdobry awesome stuff!! |
This is exactly what I want!!! Good job!! Thanks!!! |
going to close this since there are many options available and most people that uses mout should really be loading the individual modules anyway. |
sometimes it can be good for quick prototyping / testing on the console and some users might not be using AMD or browserify...
I'm thinking in some very quick-and-dirty solution that basically reuses the requirejs optimizer and maybe bundles the code with some very basic AMD shim
/cc @edankwan
The text was updated successfully, but these errors were encountered: