Skip to content

Commit ef4bda7

Browse files
committed
update
1 parent 4ff4758 commit ef4bda7

File tree

8 files changed

+221
-5
lines changed

8 files changed

+221
-5
lines changed

.gitmodules

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[submodule "modules/jquery"]
2+
path = modules/jquery
3+
url = [email protected]:jquery/jquery.git
4+
[submodule "modules/bootstrap"]
5+
path = modules/bootstrap
6+
url = [email protected]:twbs/bootstrap.git

gulpfile.js

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/* eslint-disable */
2+
const package = require("./package.json");
3+
const cleanCSS = require("gulp-clean-css");
4+
const concat = require("gulp-concat");
5+
const del = require("del");
6+
const eslint = require("gulp-eslint");
7+
const gulp = require("gulp");
8+
const gulpif = require("gulp-if");
9+
const rename = require("gulp-rename");
10+
const uglifyES = require("gulp-uglify-es").default;
11+
12+
const buildPath = "build/";
13+
14+
let watching = true;
15+
16+
const copyPaths = [{
17+
"input": "src/index.html",
18+
"output": ""
19+
},
20+
{
21+
"input": "favicon/*.{png,ico}",
22+
"output": "favicon/"
23+
},
24+
{
25+
"input": ["favicon/favicon.ico", "favicon/browserconfig.xml", "favicon/manifest.json"],
26+
"output": ""
27+
},
28+
{
29+
"input": "src/images/**/*",
30+
"output": "images/"
31+
},
32+
{
33+
"input": "vendor/**/css/**/*.css",
34+
"output": ""
35+
},
36+
{
37+
"input": "vendor/**/images/**/*",
38+
"output": ""
39+
},
40+
{
41+
"input": "vendor/**/js/**/*.js",
42+
"output": ""
43+
},
44+
{
45+
"input": "vendor/**/webfonts/**/*.{eot,svg,ttf,woff,woff2}",
46+
"output": ""
47+
},
48+
{
49+
"input": "vendor/**/cmaps/**/*",
50+
"output": ""
51+
},
52+
{
53+
"input": "vendor/**/locale/**/*",
54+
"output": ""
55+
}
56+
];
57+
58+
const jsPath = {
59+
"input": [
60+
"./src/js/prototype.js",
61+
"./src/js/jui/jComponent.js",
62+
"./src/js/jui/*.js",
63+
"./src/js/utils.js",
64+
"./src/js/header.js",
65+
"./src/js/api.js",
66+
"./src/js/config.js",
67+
"./src/js/pages/*.js",
68+
"./src/js/footer.js"
69+
],
70+
"output": "js/"
71+
};
72+
73+
const clean = (done) => {
74+
del.sync(buildPath);
75+
done();
76+
};
77+
78+
const _copy = (paths, done) => {
79+
const path = paths.pop();
80+
if (typeof path === "undefined")
81+
return done();
82+
gulp
83+
.src(path.input)
84+
.pipe(gulp.dest(buildPath + path.output))
85+
.on("end", () => {
86+
_copy(paths, done);
87+
});
88+
}
89+
90+
const copy = (done) => {
91+
_copy([...copyPaths], done);
92+
};
93+
94+
const script = () => gulp.src(jsPath.input)
95+
.pipe(eslint({
96+
"configFile": ".eslintrc"
97+
}))
98+
.pipe(eslint.format())
99+
.pipe(gulpif(!watching, eslint.failAfterError()))
100+
.pipe(concat("noobs.js"))
101+
// pipe(gulpif(!watching, uglifyES()))
102+
.pipe(gulp.dest(buildPath + jsPath.output));
103+
104+
const watch = (done) => {
105+
copyPaths.forEach((path) => gulp.watch(path.input, copy));
106+
gulp.watch(scssPath.watch, scss);
107+
gulp.watch(jsPath.input, script);
108+
return done();
109+
};
110+
111+
const production = (done) => {
112+
watching = false;
113+
return done();
114+
};
115+
116+
const development = (done) => {
117+
watching = true;
118+
return done();
119+
};
120+
121+
122+
exports.clean = gulp.series(clean);
123+
124+
exports.build = gulp.series(production, exports.clean, copy, script);
125+
126+
exports.watch = gulp.series(development, exports.clean, copy, script, watch);
127+
128+
exports.default = (done) => {
129+
// eslint-disable-next-line no-console
130+
console.log(`\n* * * Available tasks: ${Object.keys(exports)} * * *\n`);
131+
return done();
132+
};

package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"author": "Kay Anar",
3+
"dependencies": {
4+
"jsdoc": "^3.6.3"
5+
},
6+
"description": "Object Oriented Bootstrapping",
7+
"homepage": "http://anars.com/oobs/",
8+
"main": "gulpfile.js",
9+
"name": "noobs",
10+
"repository": {
11+
"type": "git",
12+
"url": "[email protected]:anars/oobs.git"
13+
},
14+
"scripts": {
15+
"build": "gulp build",
16+
"clean": "gulp clean",
17+
"watch": "gulp watch"
18+
},
19+
"version": "0.0.1",
20+
"devDependencies": {
21+
"del": "^5.1.0",
22+
"gulp": "^4.0.2",
23+
"gulp-clean-css": "^4.2.0",
24+
"gulp-concat": "^2.6.1",
25+
"gulp-eslint": "^6.0.0",
26+
"gulp-if": "^3.0.0",
27+
"gulp-rename": "^1.4.0",
28+
"gulp-uglify-es": "^2.0.0"
29+
}
30+
}

src/.DS_Store

6 KB
Binary file not shown.

src/html/index.html

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!doctype html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<meta name="description" content="">
8+
<meta name="author" content="">
9+
<title></title>
10+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
11+
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
12+
<script src="../js/OOBS.js" crossorigin="anonymous"></script>
13+
<script src="../js/components/OOBSTest.js" crossorigin="anonymous"></script>
14+
</head>
15+
16+
<body>
17+
<header>
18+
</header>
19+
<main role="main">
20+
</main>
21+
<footer>
22+
</footer>
23+
</body>
24+
25+
</html>

src/js/OOBS.js

100644100755
+7-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,15 @@ class OOBS {
2828
componentDiv.id = `${options.type}-${options.id}`;
2929
componentDiv.appendChild(documentFragment);
3030
options.attach = (options.attach || "").toLowerCase();
31-
if (options.attach === "append") {
31+
// eslint-disable-next-line no-extra-parens
32+
if (options.attach === "append" || (options.attach === "prepend" && containerElement.firstChild === null)) {
3233
containerElement.appendChild(componentDiv);
3334
} else if (options.attach === "prepend") {
34-
35+
containerElement.insertBefore(componentDiv, containerElement.firstChild);
3536
} else if (options.attach === "replace") {
36-
37+
while (containerElement.lastChild)
38+
containerElement.removeChild(containerElement.lastChild);
39+
containerElement.appendChild(componentDiv);
3740
}
3841
} catch (exception) {
3942
// eslint-disable-next-line no-console
@@ -175,4 +178,4 @@ class OOBS {
175178
return this;
176179
}
177180

178-
}
181+
}

src/js/components/OOBSTest.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"use strict";
2+
3+
// eslint-disable-next-line no-unused-vars
4+
class OOBSTest extends OOBS {
5+
6+
constructor (options = {}) {
7+
// eslint-disable-next-line no-param-reassign
8+
options = {
9+
...options
10+
};
11+
const documentFragment = new DocumentFragment();
12+
super(options, documentFragment);
13+
}
14+
15+
}

src/js/containers/OOBSContainer.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"use strict";
22

3+
/** Class representing a point. */
34
// eslint-disable-next-line no-unused-vars
45
class OOBSContainer extends OOBS {
5-
6+
/**
7+
* Create a point.
8+
* @param {number} x - The x value.
9+
* @param {number} y - The y value.
10+
*/
611
constructor (options = {}) {}
712

813
}

0 commit comments

Comments
 (0)