Skip to content

Commit

Permalink
add less. some restructering.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocordsen committed Feb 2, 2018
1 parent f0ef3d5 commit ac0afc3
Show file tree
Hide file tree
Showing 12 changed files with 750 additions and 22 deletions.
3 changes: 3 additions & 0 deletions components/app/app.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.app-component {
font-weight: bold;
}
6 changes: 3 additions & 3 deletions components/app.tsx → components/app/app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import {HeaderComponent} from "./header";
import {SidebarComponent} from "./sidebar";
import {ContentComponent} from "./content";
import {HeaderComponent} from "../header/header";
import {SidebarComponent} from "../sidebar/sidebar";
import {ContentComponent} from "../content/content";

export class AppComponent extends React.Component {
render() {
Expand Down
1 change: 1 addition & 0 deletions components/components.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "./app/app";
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<html>

<head>
<title></title>
<title>React Tutorial</title>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";
import * as ReactDOM from "react-dom";
import {AppComponent} from "./components/app";
import {AppComponent} from "./components/app/app";

ReactDOM.render(
<AppComponent/>,
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
"devDependencies": {
"@types/react": "^16.0.36",
"@types/react-dom": "^16.0.3",
"css-loader": "^0.28.9",
"html-webpack-plugin": "^2.30.1",
"webpack-dev-server": "^2.11.1",
"ts-loader": "^3.4.0"
"less": "^2.7.3",
"less-loader": "^4.0.5",
"style-loader": "^0.20.1",
"ts-loader": "^3.4.0",
"webpack-dev-server": "^2.11.1"
}
}
1 change: 1 addition & 0 deletions style/style.less
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "../components/components";
19 changes: 15 additions & 4 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const HtmlPlugin = require("html-webpack-plugin");

module.exports = {
entry: [
path.join(__dirname, "index.tsx")
//path.join(__dirname, "src/style/style.less")
path.join(__dirname, "index.tsx"),
path.join(__dirname, "style/style.less")
],
output: {
filename: "index.[hash].js",
Expand All @@ -17,8 +17,19 @@ module.exports = {
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader", query: { compilerOptions: { noEmit: false } } }
//{ test: /\.less$/, use: ["style-loader", "css-loader?-url", "less-loader"] }
{
test: /\.tsx?$/,
loader: "ts-loader",
query: {
compilerOptions: {
noEmit: false
}
}
},
{
test: /\.less$/,
use: ["style-loader", "css-loader?-url", "less-loader"]
}
]
},
plugins: [
Expand Down
Loading

0 comments on commit ac0afc3

Please sign in to comment.