Skip to content

Commit 3a0ef1c

Browse files
committed
Conditionally load flexibility for IE only
closes canjs/canjs#3100
1 parent 9a86130 commit 3a0ef1c

15 files changed

+66
-37
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ doc/
44
index.html
55
.vscode
66
*.log
7-
.DS_Store
7+
.DS_Store
8+
npm-debug.log

bit-docs.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,18 @@ module.exports = function(bitDocs){
99
bitDocs.register("html", {
1010
templates: path.join(__dirname, "templates"),
1111
dependencies: dependencies,
12-
staticDist: path.join(__dirname, "dist", "static")
12+
staticDist: path.join(__dirname, "dist", "static"),
13+
package: {
14+
steal: {
15+
configDependencies: [
16+
"./node_modules/steal-conditional/conditional"
17+
]
18+
},
19+
devDependencies: {
20+
"flexibility": "^2.0.1"
21+
}
22+
}
1323
});
1424

1525
bitDocs.register("tags", tags);
16-
}
26+
};

build-search-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var dest = siteConfig.dest + '/static/search-worker.js';
1414

1515
fs.mkdir(siteConfig.dest, function() {
1616
stealTools.export({
17-
system: {
17+
steal: {
1818
config: __dirname + '/package.json!npm',
1919
main: 'static/search-worker'
2020
},

make-example.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@ var docMap = readFile(__dirname+"/docMap.json").then(function(source){
1313
var siteConfig = {
1414
html: {
1515
templates: path.join(__dirname, "templates"),
16+
package: {
17+
steal: {
18+
configDependencies: [
19+
"./node_modules/steal-conditional/conditional"
20+
]
21+
},
22+
devDependencies: {
23+
"flexibility": "^2.0.1"
24+
}
25+
},
1626
dependencies: {
1727
"bit-docs-html-canjs": __dirname,
1828
"bit-docs-prettify": "^0.1.0",
19-
"bit-docs-html-highlight-line": "^0.2.2",
20-
//TODO: This should not be include here and should only be included in package.json.
21-
// we get an error without this, here, though
22-
"steal-stache": "^3.0.1"
29+
"bit-docs-html-highlight-line": "^0.2.2",
30+
//TODO: This should not be include here and should only be included in package.json.
31+
// we get an error without this, here, though
32+
"steal-stache": "^3.0.1",
33+
"steal-conditional": "^0.3.6"
2334
},
2435
staticDist: [
2536
path.join(__dirname, "dist", "static")

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,28 @@
3030
"url": "https://github.com/canjs/bit-docs-html-canjs/issues"
3131
},
3232
"homepage": "https://github.com/canjs/bit-docs-html-canjs#readme",
33-
"system": {},
3433
"dependencies": {
3534
"can-control": "^3.0.3",
3635
"can-util": "^3.0.10",
3736
"escape-html": "^1.0.3",
3837
"flexibility": "^2.0.1",
39-
"jquery": "^2.2.4",
38+
"jquery": "^3.1.1",
4039
"lodash": "^4.17.4",
4140
"lunr": "bit-docs/lunr.js#279-safari-exception",
4241
"steal-stache": "^3.0.1",
4342
"unescape-html": "^1.0.0"
4443
},
4544
"devDependencies": {
46-
"bit-docs-generate-html": "^0.7.0",
45+
"bit-docs-generate-html": "^0.8.0",
4746
"bit-docs-generate-searchmap": "^0.1.3",
4847
"bit-docs-html-toc": "^0.6.0",
4948
"connect": "^3.5.0",
5049
"normalize.css": "^5.0.0",
5150
"q": "^1.4.1",
52-
"steal": "^0.16.44",
53-
"steal-qunit": "^0.1.4",
51+
"steal": "^1.5.9",
52+
"steal-conditional": "^0.3.6",
53+
"steal-qunit": "^1.0.1",
54+
"steal-tools": "^1.8.2",
5455
"testee": "^0.7.0",
5556
"zombie": "^5.0.5"
5657
}

static/breadcrumb.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
}
7575
}
7676
}
77+
7778
.on-this-page {
7879
font-size: 14px;
7980
margin-bottom: @gutter !important;
@@ -117,6 +118,7 @@
117118
}
118119
}
119120
}
121+
120122
.nav-toggle {
121123
display: none;
122124
float: right;
@@ -136,6 +138,7 @@
136138
transform: rotate(90deg);
137139
}
138140
}
141+
139142
.on-this-page:empty{
140143
visibility: hidden;
141144
}

static/canjs.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var flexibility = require("flexibility");
1+
require("flexibility#?./needs-flexibility");
22
require("./canjs.less!");
33
var LoadingBar = require('./loading-bar.js');
44
$ = require("jquery");
@@ -32,8 +32,9 @@ var $articleContainer,
3232
init();
3333

3434
// flexbox for ie9/10
35-
flexibility(document.getElementById('everything'));
36-
//flexibility(document.documentElement);
35+
if(typeof flexibility !== 'undefined'){
36+
flexibility(document.getElementById('everything'));
37+
}
3738

3839
// prevent sidebar from changing width when header hides
3940
$('#left').css('min-width', $('.top-left').width());
@@ -224,7 +225,7 @@ function navigate(href, updateLocation) {
224225
},
225226
success: function(content) {
226227

227-
if(updateLocation !== false){
228+
if(window.history.pushState && updateLocation !== false){
228229
window.history.pushState(null, null, href);
229230
}
230231

@@ -284,7 +285,7 @@ function navigate(href, updateLocation) {
284285
}
285286
},
286287
error: function() {
287-
if(updateLocation !== false){
288+
if(window.history.pushState && updateLocation !== false){
288289
window.history.pushState(null, null, href);
289290
}
290291
// just reload the page if this fails

static/canjs.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*---------- UTILITIES ----------*/
2-
@import "/node_modules/normalize.css/normalize.css";
2+
@import "locate://normalize.css/normalize.css";
33
@import "variables.less";
44
@import "mixins.less";
55

static/header.less

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
.top-right-top {
2-
-js-display: flex; // ie9/10 flexbox fix
3-
display: flex;
2+
.flex;
43
flex-direction: row-reverse;
4+
-ms-flex-direction: row-reverse;
55
flex-shrink: 0;
6-
height: 53px;
6+
height: @brand-height;
77
justify-content: space-between;
88
}
9-
.top-left {
10-
display: none;
11-
}
129
.brand {
1310
height: @brand-height;
1411
padding-top: @gutter;
@@ -114,7 +111,6 @@
114111
.top-right-links {
115112
display: none;
116113
@media screen and (min-width: @breakpoint){
117-
-js-display: flex; // ie9/10 flexbox fix
118114
.flex;
119115
list-style: none;
120116
margin: @gutter @gutter*2;
@@ -123,8 +119,7 @@
123119
flex-basis: 100%;
124120
align-self: flex-start;
125121
> li {
126-
-js-display: flex; // ie9/10 flexbox fix
127-
display: flex;
122+
.flex;
128123
font-size: 14px;
129124
margin-right: @gutter;
130125
> a {
@@ -136,7 +131,6 @@
136131

137132
// ----- BITOVI BITS DROPDOWN -----
138133
.top-right-bitovi {
139-
-js-display: flex; // ie9/10 flexbox fix
140134
.flex;
141135
padding: 0;
142136
margin: 0;

static/layout.less

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#everything {
2-
-js-display: flex; // ie9/10 flexbox fix
32
.flex;
43
-webkit-flex-flow: row wrap;
54
justify-content: flex-start;
@@ -10,6 +9,7 @@
109
-webkit-overflow-scrolling: touch
1110
}
1211
#left {
12+
-ms-flex-wrap: wrap;
1313
position: fixed;
1414
width: @sidebar-width;
1515
min-width: 0;
@@ -26,6 +26,7 @@
2626
}
2727
}
2828
#right {
29+
-ms-flex-wrap: wrap;
2930
height: 100%;
3031
min-height: 100%;
3132
max-height: 100%;
@@ -54,13 +55,15 @@
5455

5556
@media screen and (min-width: @breakpoint){
5657
.top-left {
58+
width: 100%;
5759
height: auto;
5860
}
5961
}
6062
.top-right {
6163
flex-shrink: 0;
6264
flex-wrap: nowrap;
6365
height: auto;
66+
width: 100%;
6467
.border-bottom;
6568
@media screen and (min-width: @breakpoint){
6669
border: none;

0 commit comments

Comments
 (0)