To test
Clone the gist and cd into the dir
git clone https://gist.github.com/ThomasG77/7a92c94c6d7955fe81c9 demo_browserify_ol3
cd demo_browserify_ol3
Run NPM
npm install
Build the js including ol3 lib and custom code
./node_modules/.bin/browserify app.js > bundle.js
Open a browser and job done
xxxxxxxxxx
<html lang="en">
<head>
<title>OpenLayers 3 with Browserify</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="node_modules/openlayers/css/ol.css"></link>
<style>
.map {
height: 100%;
width: 100%;
}
</style>
<title>OpenLayers 3 quickstart example</title>
</head>
<body>
<div id="map" class="sidebar-map"></div>
<script src="bundle.js">
</script>
</body>
</html>