This is a starter pack for building maintainable browser library with Rollup, babel and react 🚀
MIT License
This is a starter pack for building maintanable browser library with
.js
does the trick, like the libraries created with JQueryCurrently supports the below babel plugin
.babelrc
scss
Note Make sure to isolate your styles under a particular class name like the LibraryName
to not conflict with parent caller. If you want to make use of external scss, use @import
directive like so
.libraryName {
// external
@import '../../node_modules/bootstrap/scss/bootstrap.scss';
... custom styles
}
npm run dev
To run dev server in watch mode. Which builds in /dist
directory. Open index.html
in your browser to see it in action
npm run build
...
<script src="dist/library.js"></script>
...
<script>
function success (param){
alert('Done with success, check console');
console.log(param)
}
new LibraryName('.btn', success);
</script>
moduleName
field. Then new NewName(...args)
browser
field.// setting a variable to be global
import Cache from './helpers/cache'
...
Cache.set('key', value)
import Cache from './helpers/cache'
...
// usage
export const performAction = () => {
const key = Cache.get('key')
console.log('key', key)
}
Check main.js for setting and usage in service.js
Stick to