vanilla-jet 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.grunt/compile_html.js +1 -1
- package/bin.js +2 -2
- package/framework/functions.js +81 -76
- package/package.json +1 -1
package/.grunt/compile_html.js
CHANGED
|
@@ -8,7 +8,7 @@ const path = require("path"),
|
|
|
8
8
|
|
|
9
9
|
let Functions = require('../core/external/functions.js');
|
|
10
10
|
let Dipper = require('../core/framework/dipper.js');
|
|
11
|
-
let Config = require('
|
|
11
|
+
let Config = require(processCwd() + '/index.js');
|
|
12
12
|
|
|
13
13
|
// -- Init Dipper
|
|
14
14
|
const env = process.argv[2] || 'development';
|
package/bin.js
CHANGED
|
@@ -5,5 +5,5 @@ const path = require('path');
|
|
|
5
5
|
const generate_packes_script_path = path.join(__dirname, './.scripts/generate_packages_json.js');
|
|
6
6
|
require(generate_packes_script_path);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const grunt_compile_html_path = path.join(__dirname, './.grunt/compile_html.js');
|
|
9
|
+
require(grunt_compile_html_path);
|
package/framework/functions.js
CHANGED
|
@@ -1,98 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
class Functions {
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
dipper = global.dipper;
|
|
3
|
+
constructor(endpoints) {
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
// Dipper
|
|
6
|
+
dipper = global.dipper;
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
Functions.hydrate = function(dipper) {
|
|
14
|
-
|
|
15
|
-
// -- Get vanillaJet.package.json
|
|
16
|
-
let json = dipper.openJsonFile('vanillaJet.package.json');
|
|
8
|
+
// -- Hydrate
|
|
9
|
+
Functions.hydrate(dipper);
|
|
17
10
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dipper.registerStyle('google-fonts', dipper.get_google_fonts(json.fonts));
|
|
11
|
+
// Creating endpoints array
|
|
12
|
+
this.endpoints = endpoints || {};
|
|
21
13
|
}
|
|
14
|
+
|
|
15
|
+
static hydrate(dipper) {
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (json.styles && json.styles.length > 0) {
|
|
26
|
-
|
|
27
|
-
// -- Gettign the keys
|
|
28
|
-
stylesKeys = Object.keys(json.styles);
|
|
29
|
-
|
|
30
|
-
// -- Add google-fonts to keys
|
|
31
|
-
stylesKeys.push('google-fonts');
|
|
17
|
+
// -- Get vanillaJet.package.json
|
|
18
|
+
let json = dipper.openJsonFile('vanillaJet.package.json');
|
|
32
19
|
|
|
33
|
-
// --
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
let url = json.styles[key];
|
|
37
|
-
if (!/^(https?:\/\/|\/\/)/.test(url)) {
|
|
38
|
-
dipper.registerStyle(key, dipper.style(url));
|
|
39
|
-
} else {
|
|
40
|
-
dipper.registerStyle(key, url);
|
|
41
|
-
}
|
|
20
|
+
// -- Google Fonts
|
|
21
|
+
if (json.fonts && Object.keys(json.fonts).length > 0) {
|
|
22
|
+
dipper.registerStyle('google-fonts', dipper.get_google_fonts(json.fonts));
|
|
42
23
|
}
|
|
43
|
-
}
|
|
44
|
-
dipper.registerStyle('app', dipper.style('app.min.css'), stylesKeys);
|
|
45
|
-
dipper.enqueueStyle('app');
|
|
46
|
-
|
|
47
|
-
// -- Scripts
|
|
48
|
-
let scriptsKeys = [];
|
|
49
|
-
if (json.dependencies && json.dependencies.length > 0) {
|
|
50
24
|
|
|
51
|
-
//
|
|
52
|
-
|
|
25
|
+
// - Styles
|
|
26
|
+
let stylesKeys = [];
|
|
27
|
+
if (json.styles) {
|
|
53
28
|
|
|
54
|
-
// --
|
|
55
|
-
|
|
56
|
-
let keyName = keyParts[0];
|
|
57
|
-
let keyRequires = keyParts[1] || '';
|
|
29
|
+
// -- Gettign the keys
|
|
30
|
+
stylesKeys = Object.keys(json.styles);
|
|
58
31
|
|
|
59
|
-
// -- Add
|
|
60
|
-
|
|
32
|
+
// -- Add google-fonts to keys
|
|
33
|
+
stylesKeys.push('google-fonts');
|
|
61
34
|
|
|
62
|
-
// --
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
35
|
+
// -- Adding styles
|
|
36
|
+
for (let key in json.styles) {
|
|
37
|
+
// -- Check if init with http or https
|
|
38
|
+
let url = json.styles[key];
|
|
39
|
+
if (!/^(https?:\/\/|\/\/)/.test(url)) {
|
|
40
|
+
dipper.registerStyle(key, dipper.style(url));
|
|
67
41
|
} else {
|
|
68
|
-
dipper.
|
|
42
|
+
dipper.registerStyle(key, url);
|
|
69
43
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
dipper.registerStyle('app', dipper.style('app.min.css'), stylesKeys);
|
|
47
|
+
dipper.enqueueStyle('app');
|
|
48
|
+
|
|
49
|
+
// -- Scripts
|
|
50
|
+
let scriptsKeys = [];
|
|
51
|
+
if (json.dependencies) {
|
|
52
|
+
|
|
53
|
+
// -- Adding scripts
|
|
54
|
+
for (let key in json.dependencies) {
|
|
55
|
+
|
|
56
|
+
// -- Key name and requires
|
|
57
|
+
let keyParts = key.split(':');
|
|
58
|
+
let keyName = keyParts[0];
|
|
59
|
+
let keyRequires = keyParts[1] || '';
|
|
60
|
+
|
|
61
|
+
// -- Add key to scriptsKeys
|
|
62
|
+
scriptsKeys.push(keyName);
|
|
63
|
+
|
|
64
|
+
// -- Check if init with http or https
|
|
65
|
+
let url = json.dependencies[key];
|
|
66
|
+
if (!/^(https?:\/\/|\/\/)/.test(url)) {
|
|
67
|
+
dipper.registerScript(
|
|
68
|
+
keyName,
|
|
69
|
+
dipper.script(url),
|
|
70
|
+
(keyRequires !== '') ? [keyRequires] : undefined
|
|
71
|
+
);
|
|
73
72
|
} else {
|
|
74
|
-
dipper.registerScript(
|
|
73
|
+
dipper.registerScript(
|
|
74
|
+
keyName,
|
|
75
|
+
url,
|
|
76
|
+
(keyRequires !== '') ? [keyRequires] : undefined
|
|
77
|
+
);
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
}
|
|
81
|
+
scriptsKeys.push('jquery');
|
|
82
|
+
scriptsKeys.push('underscore');
|
|
83
|
+
dipper.registerScript('vanillaJet', dipper.script('core/vanillaJet.js'), scriptsKeys);
|
|
84
|
+
dipper.enqueueScript('vanillaJet');
|
|
85
|
+
|
|
86
|
+
// -- Main app
|
|
87
|
+
dipper.registerScript('vanilla', dipper.script('vanilla.js'));
|
|
88
|
+
dipper.enqueueScript('vanilla');
|
|
89
|
+
|
|
90
|
+
// Adding meta tags
|
|
91
|
+
dipper.addMeta('UTF-8', '', 'charset');
|
|
92
|
+
dipper.addMeta('viewport', 'width=device-width, minimum-scale=1');
|
|
93
|
+
dipper.addMeta('og:title', dipper.getPageTitle(), 'property');
|
|
94
|
+
dipper.addMeta('og:site_name', dipper.getSiteTitle(), 'property');
|
|
95
|
+
dipper.addMeta('og:description', dipper.getDescription(), 'property');
|
|
96
|
+
dipper.addMeta('og:image', dipper.img('logo.png'), 'property');
|
|
97
|
+
dipper.addMeta('og:type', 'website', 'property');
|
|
98
|
+
dipper.addMeta('og:url', dipper.urlTo(''), 'property');
|
|
99
|
+
dipper.addMeta('theme-color', '#ffffff', '');
|
|
78
100
|
}
|
|
79
|
-
dipper.registerScript('vanillaJet', dipper.script('core/vanillaJet.js'), scriptsKeys);
|
|
80
|
-
dipper.enqueueScript('vanillaJet');
|
|
81
|
-
|
|
82
|
-
// -- Main app
|
|
83
|
-
dipper.registerScript('vanilla', dipper.script('vanilla.js'));
|
|
84
|
-
dipper.enqueueScript('vanilla');
|
|
85
|
-
|
|
86
|
-
// Adding meta tags
|
|
87
|
-
dipper.addMeta('UTF-8', '', 'charset');
|
|
88
|
-
dipper.addMeta('viewport', 'width=device-width, minimum-scale=1');
|
|
89
|
-
dipper.addMeta('og:title', dipper.getPageTitle(), 'property');
|
|
90
|
-
dipper.addMeta('og:site_name', dipper.getSiteTitle(), 'property');
|
|
91
|
-
dipper.addMeta('og:description', dipper.getDescription(), 'property');
|
|
92
|
-
dipper.addMeta('og:image', dipper.img('logo.png'), 'property');
|
|
93
|
-
dipper.addMeta('og:type', 'website', 'property');
|
|
94
|
-
dipper.addMeta('og:url', dipper.urlTo(''), 'property');
|
|
95
|
-
dipper.addMeta('theme-color', '#ffffff', '');
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
module.exports = Functions;
|