Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adonig committed Apr 9, 2020
1 parent 82bb41c commit 47b0097
Show file tree
Hide file tree
Showing 17 changed files with 1,253 additions and 269 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"css.validate": false
}
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright 2020 Andreas Donig

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app).
# nextjs-starter-preact-tailwindcss

This is a [Next.js](https://nextjs.org/) starter project coming with [Preact](https://preactjs.com/) and [Tailwind CSS](https://tailwindcss.com/) built-in.

## Getting Started

Expand All @@ -12,19 +14,13 @@ yarn dev

Open [http:https://localhost:3000](http:https://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

You can check out [the Next.js GitHub repository](https://github.com/zeit/next.js/) - your feedback and contributions are welcome!
## Visual Studio Code

## Deploy on ZEIT Now
From my experience Tailwind CSS works best with [stylelint](https://stylelint.io/), so you might want to install the following extensions:

The easiest way to deploy your Next.js app is to use the [ZEIT Now Platform](https://zeit.co/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
- [vscode-stylelint](https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint)
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Also make sure you locally disable any interfering extensions (i.e. SCSS Formatter) in your workspace.
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const withBundleAnalyzer = require("@next/bundle-analyzer")({
enabled: process.env.ANALYZE === "true",
});

module.exports = withBundleAnalyzer({});
18 changes: 15 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,25 @@
"version": "0.1.0",
"private": true,
"scripts": {
"analyze": "ANALYZE=true next build",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"next": "9.3.4",
"react": "16.13.1",
"react-dom": "16.13.1"
"@next/bundle-analyzer": "^9.3.4",
"next": "^9.3.4",
"preact": "^10.4.0",
"preact-render-to-string": "^5.1.5",
"react": "github:preact-compat/react#1.0.0",
"react-dom": "github:preact-compat/react-dom#1.0.0"
},
"devDependencies": {
"@fullhuman/postcss-purgecss": "^2.1.2",
"@types/node": "^13.11.1",
"@types/react": "^16.9.33",
"postcss-preset-env": "^6.7.0",
"stylelint-config-recommended": "^3.0.0",
"tailwindcss": "^1.2.0"
}
}
203 changes: 0 additions & 203 deletions pages/index.js

This file was deleted.

20 changes: 20 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// postcss.config.js
module.exports = {
plugins: [
"tailwindcss",
...(process.env.NODE_ENV === "production"
? [
[
"@fullhuman/postcss-purgecss",
{
content: ["./src/**/*.{js,jsx,ts,tsx}"],
defaultExtractor: (content) =>
content.match(/[\w-/:]+(?<!:)/g) || [],
whitelist: ["html", "body"],
},
],
]
: []),
"postcss-preset-env",
],
};
12 changes: 12 additions & 0 deletions src/components/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import Head from "next/head";

export default (props) => (
<div className="p-4 shadow rounded bg-white">
<Head>
<title>Next.js + Preact + Tailwind CSS</title>
<link rel="icon" href="/favicon.ico" />
</Head>
<main>{props.children}</main>
</div>
);
5 changes: 5 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import "../styles/main.css";

export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}
14 changes: 14 additions & 0 deletions src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from "react";
import Link from "next/link";

import Layout from "../components/Layout";

export default () => (
<Layout>
<h1 className="text-purple-500 leading-normal">About</h1>
<p className="text-gray-500">This is the about page.</p>
<Link href="/">
<a>back</a>
</Link>
</Layout>
);
20 changes: 20 additions & 0 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from "react";
import Link from "next/link";

import Layout from "../components/Layout";

export default () => (
<Layout>
<h1 className="text-purple-500 leading-normal">
<a href="https://nextjs.org/">Next.js</a> +{" "}
<a href="https://preactjs.com/">Preact</a> +{" "}
<a href="https://tailwindcss.com/">Tailwind CSS</a>
</h1>
<p className="text-gray-500">
Get started by editing <code>pages/index.tsx</code>
</p>
<Link href="/about">
<a>About</a>
</Link>
</Layout>
);
7 changes: 7 additions & 0 deletions src/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
@apply bg-blue-500 p-12;
}
19 changes: 19 additions & 0 deletions stylelint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
extends: ["stylelint-config-recommended"],
rules: {
"at-rule-no-unknown": [
true,
{
ignoreAtRules: [
"tailwind",
"apply",
"variants",
"responsive",
"screen",
],
},
],
"declaration-block-trailing-semicolon": null,
"no-descending-specificity": null,
},
};
Loading

0 comments on commit 47b0097

Please sign in to comment.