Skip to content

Commit

Permalink
Add less & scss example.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Sep 7, 2019
1 parent 2e74b9d commit f5e41ec
Show file tree
Hide file tree
Showing 26 changed files with 453 additions and 81 deletions.
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
Basic Example
---
<p align="center">
<a href="https://github.com/kktjs/kkt">
<img src="./website/kkt.svg?sanitize=true">
</a>
</p>

```bash
npm run watch # Listen compile .ts files.
npm run build # compile .ts files.
<p align="center">
<a href="https://github.com/kktjs/kkt/issues">
<img src="https://img.shields.io/github/issues/kktjs/kkt.svg">
</a>
<a href="https://github.com/kktjs/kkt/network">
<img src="https://img.shields.io/github/forks/kktjs/kkt.svg">
</a>
<a href="https://github.com/kktjs/kkt/stargazers">
<img src="https://img.shields.io/github/stars/kktjs/kkt.svg">
</a>
<a href="https://github.com/kktjs/kkt/releases">
<img src="https://img.shields.io/github/release/kktjs/kkt.svg">
</a>
<a href="https://www.npmjs.com/package/kkt">
<img src="https://img.shields.io/npm/v/kkt.svg">
</a>
</p>


Create React apps with no build configuration, Cli tool for creating react apps. Another tool, [`kkt-ssr`](https://github.com/kktjs/kkt-ssr), Is a lightweight framework for static and server-rendered applications.

npm run start
```
## Usage

You will need [`Node.js`](https://nodejs.org) installed on your system.

```bash
npm install kkt@next
```
15 changes: 15 additions & 0 deletions example/less/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
dist
npm-debug.log*
package-lock.json
.DS_Store
.cache
.rdoc-dist
.vscode

*.bak
*.tem
*.temp
#.swp
*.*~
~*.*
4 changes: 4 additions & 0 deletions example/less/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Less
===

Less Example.
35 changes: 35 additions & 0 deletions example/less/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "default",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"start": "kkt start",
"build": "kkt build"
},
"repository": {
"type": "git",
"url": "https://github.com/kktjs/kkt.git"
},
"author": "",
"license": "MIT",
"dependencies": {
"react": "^16.4.0",
"react-dom": "^16.4.0"
},
"devDependencies": {
"kkt": "file:../../"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added example/less/public/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions example/less/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!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>Less Example for KKT.</title>
</head>

<body>
<div id="root"></div>
</body>

</html>
38 changes: 38 additions & 0 deletions example/less/src/app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import styles from './App.module.less';

class App extends Component {
render() {
return (
<div className={styles.App}>
<header className={styles.AppHeader}>
<img src={logo} className={styles.AppLogo} alt="logo" />
<p>
Edit <code>src/app/App.js</code> and save to reload.
</p>
<div>
<a
className={styles.AppLink}
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<a
className={styles.AppLink}
href="https://github.com/kktjs/kkt"
target="_blank"
rel="noopener noreferrer"
>
Learn KKT
</a>
</div>
</header>
</div>
);
}
}

export default App;
34 changes: 34 additions & 0 deletions example/less/src/app/App.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.App {
text-align: center;
}

.AppLogo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
}

.AppHeader {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.AppLink {
color: #61dafb;
display: inline-block;
margin: 0 5px;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
7 changes: 7 additions & 0 deletions example/less/src/app/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions example/less/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './app/App';
import './index.module.less';


ReactDOM.render(
<App />,
document.getElementById('root'),
);
4 changes: 4 additions & 0 deletions example/less/src/index.module.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
margin: 0;
padding: 0;
}
15 changes: 15 additions & 0 deletions example/scss/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
dist
npm-debug.log*
package-lock.json
.DS_Store
.cache
.rdoc-dist
.vscode

*.bak
*.tem
*.temp
#.swp
*.*~
~*.*
2 changes: 2 additions & 0 deletions example/scss/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scss
===
24 changes: 24 additions & 0 deletions example/scss/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "default",
"version": "1.0.0",
"description": "",
"private": true,
"scripts": {
"start": "kkt start",
"build": "kkt build"
},
"repository": {
"type": "git",
"url": "https://github.com/kktjs/kkt.git"
},
"author": "",
"license": "MIT",
"dependencies": {
"react": "^16.4.0",
"react-dom": "^16.4.0"
},
"devDependencies": {
"kkt": "file:../../",
"@kkt/plugin-scss": "^1.0.3"
}
}
Binary file added example/scss/public/favicon.ico
Binary file not shown.
15 changes: 15 additions & 0 deletions example/scss/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!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>KKT</title>
</head>

<body>
<div id="root"></div>
</body>

</html>
16 changes: 16 additions & 0 deletions example/scss/src/app/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
body {
margin: 0;
padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
"Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
background: #fff3;
padding: 0 5px;
border-radius: 3px;
}
40 changes: 40 additions & 0 deletions example/scss/src/app/App.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import styles from './App.module.scss';
import './App.css';
import './App.scss';

class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/app/App.js</code> and save to reload.
</p>
<div>
<a
className={styles.AppLink}
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
<a
className={styles.AppLink}
href="https://github.com/kktjs/kkt"
target="_blank"
rel="noopener noreferrer"
>
Learn KKT
</a>
</div>
</header>
</div>
);
}
}

export default App;
6 changes: 6 additions & 0 deletions example/scss/src/app/App.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.AppLink {
color: #61dafb;
display: inline-block;
margin: 0 5px;
}
29 changes: 29 additions & 0 deletions example/scss/src/app/App.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.App {
text-align: center;
}

.App-logo {
animation: App-logo-spin infinite 20s linear;
height: 40vmin;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}


@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
7 changes: 7 additions & 0 deletions example/scss/src/app/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions example/scss/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react';
import ReactDOM from 'react-dom';
import App from './app/App';


ReactDOM.render(
<App />,
document.getElementById('root'),
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kkt",
"version": "4.2.0",
"version": "5.0.0-alpha.1",
"description": "Create React apps with no build configuration, Cli tool for creating react apps.",
"author": "Kenny Wong <wowohoo@qq.com> (https://github.com/jaywcjlove)",
"scripts": {
Expand Down

0 comments on commit f5e41ec

Please sign in to comment.