- each module should be created as a sub directory
- each module should then register itself for export inside the index.js in the root of the repo
Add this to your bower.json
"dependencies": {
"versal-shared-modules": "versal-shared-modules"
}
Then run:
bower install
Then in your HTML, if you are into browser globals:
<script type="text/javascript" src="../versal-shared-modules/your_module/your_module.js"></script>
And now the module should be available under window.yourModule
- Export the module build as an UMD
- Add it to module.exports in index.js
- Prefer CommonJS with browserify. UMD can be built by using the standalone option of browserify. With browserify-grunt, it looks like this
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
opts: {
path: '.',
name: 'vs.sanitize'
},
browserify: {
dev: {
options: {
bundleOptions: {
/* absolutely necessary */
standalone: '<%= opts.name %>'
}
},
files: {
'<%= opts.path %>/dist/<%= opts.name %>.js': ['<%= opts.path %>/scripts/versal.sanitize.js']
}
}
}
})