Skip to content
This repository was archived by the owner on Aug 27, 2020. It is now read-only.

deptno/next.js-typescript-starter-kit

Repository files navigation

Next.js TypeScript Starter Kit CircleCI

samples

Start with sample

Latest update

  • typescript@3.0.1
  • next@6.1.1
  • react@16.4

see ChangeLog

Feature

  • TypeScript
  • Styled-jsx
  • Module css (PostCSS - cssnext, nested, import)
  • SEO & analytics(Google Analytics, Facebook Pixel, Naver Analytics)
  • Storybook (support module css)
  • Jest & Enzyme (support module css)

Packages

  • next@6.1.1
  • react@16.4
  • redux-thunk
  • react-ga
  • redux-persist@4

Load from CDN

  • font-awesome@5

Installation

git clone https://github.com/deptno/next.js-typescript-starter-kit my-project
cd my-project
rm -r .git
npm install

Run πŸš€

πŸš€ Test

npm run test # test
npm run test:watch
npm run test:coverage # report coverage

πŸš€ StoryBook

npm run storybook # open browser localhost:6006
npm run build-storybook # Build storybook static assets

πŸš€ Development

npm run start:dev # run

πŸš€ Production

Serve

npm install
npm run build # create .next directory
npm start # start server

Build static HTML

npm install
npm run build # create .next directory
npm run export # create .out directory

Configuration

Set SEO & analytics variables

src/constants/env.ts

export const GA_TRACKING_ID = ''
export const FB_TRACKING_ID = ''
export const SENTRY_TRACKING_ID = ''

// for meta tag <og & twitter>
export const SITE_NAME = ''
export const SITE_TITLE = ''
export const SITE_DESCRIPTION = ''
export const SITE_IMAGE = ''

If each variable evaluated false, it does not load related library

Usage

import * as classnames from 'classnames'
import * as css from './Home.css'

export const Just = props => <div className={css.className}>
export const Mixed = props => <div className={classnames('row', 'home', css.home)}>

Styled-jsx

const Layout = props =>
  <head>
    <style jsx global>{`
      div > * {
        font-size: 32px;
      }
    `}
    </style>
  </head>
export const Home = props =>
  <div>
    <style jsx>{`{
      color: darkred;
    }`}</style>
    home
  </div>

Others

Related