Reputation: 17164
I have a simple browserify setup in my Gruntfile.js
browserify: {
dist: {
src: 'public/js/main.js',
dest: 'public/js/bundle.js'
}
}
But how can I access party of my code from the browser? It seems like the module is completely encapulated. But I need to access some methods from <script>
tags in my output.
From the console this works browserify -s myExport public/js/main.js -o public/js/bundle.js
But I can't get grunt-browserify
to execute that.
Upvotes: 1
Views: 357
Reputation: 17164
I ended up with this (working):
browserify: {
options: {
transform: [ require('grunt-react').browserify ],
browserifyOptions: {
debug: true,
standalone: 'myExport'
}
},
dev: {
src: 'public/js/main.js',
dest: 'public/js/bundle.js'
},
dist: {
src: 'public/js/main.js',
dest: 'public/js/bundle.js'
}
}
Upvotes: 2