Skip to content

Instantly share code, notes, and snippets.

@shawnbot
Last active April 16, 2018 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shawnbot/53600929cc8735e8e4fe26a960c0d4cb to your computer and use it in GitHub Desktop.
Save shawnbot/53600929cc8735e8e4fe26a960c0d4cb to your computer and use it in GitHub Desktop.
Parcel + Preact
{
"presets": ["env", "react"]
}
node_modules
.cache
dist/
<!doctype html>
<html lang="en">
<head>
<title>Parcel + React test</title>
</head>
<body>
<div id="app"></div>
<script src="./index.js"></script>
</body>
</html>
import React from 'react'
import {render} from 'react-dom'
import styled from 'styled-components'
const Box = styled.div`
background-color: #eee;
border: 1px solid #999;
padding: 1em;
> * {
margin: 0;
}
`
render((
<Box>
<h1>Hello, world!</h1>
</Box>
), document.getElementById('app'))
{
"private": true,
"main": "index.js",
"scripts": {
"start": "parcel index.html",
"prebuild": "rm -rf dist",
"build": "NODE_ENV=production parcel build",
"postbuild": "gzip-size dist/*.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"gzip-size-cli": "^2.1.0",
"parcel-bundler": "^1.7.1"
},
"dependencies": {
"react": "^16.3.2",
"react-dom": "^16.3.2",
"styled-components": "^3.2.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment