Skip to content

Commit 32c1dae

Browse files
CYBAIAllenFang
authored andcommitted
Use sass for styles (#4)
* Use sass for styles Scss files under `styles` folder are compiled from `public/less`. * Use single quote * Set webpack alias for styles * Use resolve.modulesDirectories for require relative path
1 parent 7d6f40c commit 32c1dae

File tree

13 files changed

+802
-8
lines changed

13 files changed

+802
-8
lines changed

config/webpack.config.dev.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ var getClientEnvironment = require('./env');
1010
var paths = require('./paths');
1111

1212

13-
1413
// Webpack uses `publicPath` to determine where the app is being served from.
1514
// In development, we always serve from the root. This makes config easier.
1615
var publicPath = '/';
@@ -75,10 +74,11 @@ module.exports = {
7574
// some tools, although we do not recommend using it, see:
7675
// https://github.com/facebookincubator/create-react-app/issues/290
7776
extensions: ['.js', '.json', '.jsx', ''],
77+
modulesDirectories: [ 'src-react', 'node_modules' ],
7878
alias: {
7979
// Support React Native Web
8080
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
81-
'react-native': 'react-native-web'
81+
'react-native': 'react-native-web',
8282
}
8383
},
8484

@@ -111,6 +111,7 @@ module.exports = {
111111
// Webpack 2 fixes this, but for now we include this hack.
112112
// https://github.com/facebookincubator/create-react-app/issues/1713
113113
/\.(js|jsx)(\?.*)?$/,
114+
/\.scss$/,
114115
/\.css$/,
115116
/\.json$/,
116117
/\.svg$/
@@ -143,6 +144,10 @@ module.exports = {
143144
test: /\.css$/,
144145
loader: 'style!css?importLoaders=1!postcss'
145146
},
147+
{
148+
test: /\.scss$/,
149+
loader: 'style!css!sass'
150+
},
146151
// JSON is not enabled by default in Webpack but both Node and Browserify
147152
// allow it implicitly so we also enable it.
148153
{

config/webpack.config.prod.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,11 @@ module.exports = {
7979
// some tools, although we do not recommend using it, see:
8080
// https://github.com/facebookincubator/create-react-app/issues/290
8181
extensions: ['.js', '.json', '.jsx', ''],
82+
modulesDirectories: [ 'src-react', 'node_modules' ],
8283
alias: {
8384
// Support React Native Web
8485
// https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/
85-
'react-native': 'react-native-web'
86+
'react-native': 'react-native-web',
8687
}
8788
},
8889

package.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"bluebird": "~3.5.0",
3030
"blueimp-md5": "~2.7.0",
3131
"body-parser": "~1.17.1",
32+
"bootstrap-sass": "^3.3.7",
3233
"color": "~1.0.3",
3334
"cookie-parser": "~1.4.3",
3435
"crossroads": "~0.12.2",
@@ -55,6 +56,10 @@
5556
"passport-local": "~1.0.0",
5657
"raven": "~1.2.1",
5758
"rc": "~1.2.1",
59+
"react": "^15.5.4",
60+
"react-dom": "^15.5.4",
61+
"react-redux": "^5.0.4",
62+
"redux": "^3.6.0",
5863
"rimraf": "~2.6.1",
5964
"semver": "~5.3.0",
6065
"serve-static": "~1.12.2",
@@ -64,11 +69,7 @@
6469
"superagent": "^0.21.0",
6570
"temp": "~0.8.3",
6671
"winston": "~2.3.1",
67-
"yargs": "~8.0.0-candidate.0",
68-
"react": "^15.5.4",
69-
"react-dom": "^15.5.4",
70-
"react-redux": "^5.0.4",
71-
"redux": "^3.6.0"
72+
"yargs": "~8.0.0-candidate.0"
7273
},
7374
"devDependencies": {
7475
"ansi-color": "~0.2.1",
@@ -122,11 +123,13 @@
122123
"jest": "18.1.0",
123124
"json-loader": "0.5.4",
124125
"mocha": "~3.3.0",
126+
"node-sass": "^4.5.3",
125127
"object-assign": "4.1.1",
126128
"phantomjs-prebuilt": "~2.1.14",
127129
"postcss-loader": "1.2.2",
128130
"promise": "7.1.1",
129131
"react-dev-utils": "^0.5.2",
132+
"sass-loader": "^6.0.5",
130133
"style-loader": "0.13.1",
131134
"supertest": "~3.0.0",
132135
"url-loader": "0.5.7",

src-react/containers/path.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React, { Component } from 'react';
22
import { connect } from 'react-redux'
33

4+
import 'styles/styles.scss';
5+
46
@connect(state => { return { ...state } })
57
class Path extends Component {
68
render() {

src-react/styles/d2h.scss

Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
/*
2+
*
3+
* Diff to HTML (diff2html.css)
4+
* Author: rtfpessoa
5+
* Modified by: codingtwinky
6+
* Date: Friday 29 August 2014
7+
* Last Update: Saturday 27 September 2014
8+
*
9+
*/
10+
11+
.d2h-wrapper {
12+
display: block;
13+
margin: 0 auto;
14+
text-align: left;
15+
width: 100%;
16+
}
17+
18+
.d2h-file-wrapper {
19+
border-radius: 3px;
20+
}
21+
22+
.d2h-file-header {
23+
display: none;
24+
}
25+
26+
.d2h-file-stats {
27+
display: inline;
28+
font-size: 12px;
29+
text-align: center;
30+
max-width: 15%;
31+
}
32+
33+
.d2h-lines-added {
34+
background-color: #ceffce;
35+
border: 1px solid #b4e2b4;
36+
color: #FFFFFF;
37+
border-radius: 5px 0 0 5px;
38+
padding: 2px;
39+
width: 25px;
40+
}
41+
42+
.d2h-lines-deleted {
43+
background-color: #f7c8c8;
44+
border: 1px solid #e9aeae;
45+
color: #000000;
46+
border-radius: 0 5px 5px 0;
47+
padding: 2px;
48+
width: 25px;
49+
}
50+
51+
.d2h-file-name {
52+
display: inline;
53+
height: 33px;
54+
max-width: 80%;
55+
white-space: nowrap;
56+
text-overflow: ellipsis;
57+
overflow: hidden;
58+
}
59+
60+
.d2h-diff-table {
61+
border-collapse: collapse;
62+
font-family: 'Source Code Pro';
63+
font-size: 12px;
64+
height: 19px;
65+
width: 100%;
66+
tbody > tr > td {
67+
padding: 0px;
68+
border-spacing: 0px;
69+
height: 105%;
70+
}
71+
}
72+
73+
.d2h-files-diff {
74+
width: 100%;
75+
display: flex;
76+
}
77+
78+
.d2h-file-diff {
79+
overflow-x: auto;
80+
overflow-y: hidden;
81+
}
82+
83+
.d2h-file-side-diff {
84+
display: inline-block;
85+
overflow-x: auto;
86+
width: 50%;
87+
}
88+
89+
.d2h-code-line {
90+
white-space: pre;
91+
padding-left: 10px;
92+
padding-right: 10px;
93+
display: inline-flex;
94+
}
95+
96+
.d2h-code-side-line {
97+
white-space: pre;
98+
padding-left: 5px;
99+
padding-right: 5px;
100+
display: inline-flex;
101+
}
102+
103+
.d2h-code-line del,
104+
.d2h-code-side-line del {
105+
display: inline-block;
106+
margin-top: -1px;
107+
text-decoration: none;
108+
background-color: rgba(255, 255, 255, 0.2);
109+
}
110+
111+
.d2h-code-line ins,
112+
.d2h-code-side-line ins {
113+
display: inline-block;
114+
margin-top: -1px;
115+
text-decoration: none;
116+
background-color: rgba(255, 255, 255, 0.6);
117+
}
118+
119+
.d2h-code-line-prefix {
120+
display: inline-flex;
121+
margin-right: 10px;
122+
}
123+
124+
.line-num1 {
125+
display: inline-block;
126+
float: left;
127+
width: 30px;
128+
overflow: hidden;
129+
text-overflow: ellipsis;
130+
}
131+
132+
.line-num2 {
133+
display: inline-block;
134+
float: right;
135+
width: 30px;
136+
overflow: hidden;
137+
text-overflow: ellipsis;
138+
}
139+
140+
.d2h-code-linenumber {
141+
position: static;
142+
width: 52px;
143+
min-width: 65px;
144+
text-align: center;
145+
background-color: #727a83;
146+
color: rgba(0, 0, 0, 0.5);
147+
border-width: 0 1px 0 1px;
148+
cursor: pointer;
149+
overflow: hidden;
150+
text-overflow: ellipsis;
151+
border-left: 1px solid rgba(0, 0, 0, 0.34);
152+
border-right: 1px solid rgba(0, 0, 0, 0.34);
153+
}
154+
155+
.d2h-cntx {
156+
color: rgba(255, 255, 255, 0.3);
157+
}
158+
159+
.d2h-code-side-linenumber {
160+
position: static;
161+
display: table-cell;
162+
width: 52px;
163+
min-width: 65px;
164+
text-align: center;
165+
height: 100%;
166+
background-color: rgba(114, 122, 131, 1);
167+
color: rgba(0, 0, 0, 0.5);
168+
border-width: 0 1px 0 1px;
169+
cursor: pointer;
170+
overflow: hidden;
171+
text-overflow: ellipsis;
172+
border-left: 1px solid rgba(0, 0, 0, 0.34);
173+
border-right: 1px solid rgba(0, 0, 0, 0.34);
174+
}
175+
176+
.d2h-del {
177+
background-color: #E86756;
178+
color: #FFFFFF;
179+
180+
&.d2h-code-side-linenumber {
181+
color: rgba(0, 0, 0, 0.5);
182+
}
183+
}
184+
185+
.d2h-ins {
186+
background-color: #66F27B;
187+
color: #000000;
188+
189+
&.d2h-code-side-linenumber {
190+
color: rgba(0, 0, 0, 0.5);
191+
}
192+
}
193+
194+
.d2h-info {
195+
color: rgba(255, 255, 255, 0.3);
196+
}
197+
198+
.d2h-code-line-ctn {
199+
.word-wrap & {
200+
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
201+
white-space: -webkit-pre-wrap; /*Chrome & Safari */
202+
white-space: -pre-wrap; /* Opera 4-6 */
203+
white-space: -o-pre-wrap; /* Opera 7 */
204+
white-space: pre-wrap; /* css-3 */
205+
}
206+
}

src-react/styles/fonts/OpenSans.woff

21.4 KB
Binary file not shown.
19.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)