Skip to content

Instantly share code, notes, and snippets.

@dazld
Last active September 7, 2018 15:04
Show Gist options
  • Save dazld/0c19582a14b8d657649af01d2c23f0e9 to your computer and use it in GitHub Desktop.
Save dazld/0c19582a14b8d657649af01d2c23f0e9 to your computer and use it in GitHub Desktop.
barebones livereload

running

  • clone this gist  git clone https://gist.github.com/0c19582a14b8d657649af01d2c23f0e9.git my-project
  • cd my-project
  • npm install
  • npm run start

making a build

  • npm run build will output a bundle.js file to the directory suitable for publishing to static hosting etc. might want to run it through uglify or something too ;)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1, user-scalable=yes">
<title></title>
<link rel="stylesheet" href="main.css">
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
console.log('i am a commonjs entrypoint');
@import url(/node_modules/normalize.css/normalize.css);
body {
height: 100%;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
{
"name": "proto",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "budo index.js:bundle.js --live",
"build": "browserify index.js -o bundle.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"budo": "^11.3.2"
},
"dependencies": {
"normalize.css": "^8.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment