Created
March 19, 2018 16:27
-
-
Save fusionstrings/b8e5a9b3fb7f40b422fc7de8d5386775 to your computer and use it in GitHub Desktop.
Parcel Express
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
function Hello(){ | |
return ( | |
<h1>Hello! Parcel App</h1> | |
); | |
} | |
function App(){ | |
return <Hello /> | |
} | |
ReactDOM.render(<App />, document.getElementById('main')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Parcel is awesome</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<main id="main"></main> | |
<script src="app.js"></script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Path = require('path'); | |
const Bundler = require('parcel-bundler'); | |
const express = require('express'); | |
const app = express(); | |
const file = Path.join(__dirname, './index.html'); | |
const bundler = new Bundler(file); | |
app.use(bundler.middleware()); | |
app.use(express.static('dist')); | |
app.listen(3000, () => { | |
console.log('server running on port 3000'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 0; | |
padding: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment