Included dependencies to avoid requiring the network

This commit is contained in:
Alexandre Bourlier 2018-03-12 14:25:28 +01:00
parent 386938389f
commit 6aaf5da47a
11 changed files with 102 additions and 10 deletions

4
.gitignore vendored
View File

@ -5,3 +5,7 @@ dist/css/*
!dist/css/.gitkeep
dist/html/*
!dist/html/.gitkeep
# Files
index.html

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "dist/lib/ldp-display"]
path = dist/lib/ldp-display
url = git@git.happy-dev.fr:happy-dev/ldp-display.git

View File

@ -24,7 +24,7 @@ module.exports = function(grunt) {
},
dist: {
src: ['src/html/header.html', 'src/html/*.html', '!src/html/footer.html', 'src/html/footer.html'],
dest: 'dist/html/index.html'
dest: 'index.html'
}
},
@ -37,6 +37,8 @@ module.exports = function(grunt) {
//},
watch: {
files: ['src/**/*'],
tasks: ['concat', 'sass'],
}
});

View File

@ -1,2 +1,3 @@
**Requires**
- Grunt CLI
- Install submodules

0
dist/html/.gitkeep vendored
View File

1
dist/lib/ldp-display vendored Submodule

@ -0,0 +1 @@
Subproject commit 12191b9bce13e7d68eb5415de7871543cfa123f4

74
dist/lib/webcomponents-loader.js vendored Normal file
View File

@ -0,0 +1,74 @@
/**
* @license
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
(function() {
'use strict';
// global for (1) existence means `WebComponentsReady` will file,
// (2) WebComponents.ready == true means event has fired.
window.WebComponents = window.WebComponents || {};
var name = 'webcomponents-loader.js';
// Feature detect which polyfill needs to be imported.
var polyfills = [];
if (!('import' in document.createElement('link'))) {
polyfills.push('hi');
}
if (!('attachShadow' in Element.prototype && 'getRootNode' in Element.prototype) ||
(window.ShadyDOM && window.ShadyDOM.force)) {
polyfills.push('sd');
}
if (!window.customElements || window.customElements.forcePolyfill) {
polyfills.push('ce');
}
// NOTE: any browser that does not have template or ES6 features
// must load the full suite (called `lite` for legacy reasons) of polyfills.
if (!('content' in document.createElement('template')) || !window.Promise || !Array.from ||
// Edge has broken fragment cloning which means you cannot clone template.content
!(document.createDocumentFragment().cloneNode() instanceof DocumentFragment)) {
polyfills = ['lite'];
}
if (polyfills.length) {
var script = document.querySelector('script[src*="' + name +'"]');
var newScript = document.createElement('script');
// Load it from the right place.
var replacement = 'webcomponents-' + polyfills.join('-') + '.js';
var url = script.src.replace(name, replacement);
newScript.src = url;
// NOTE: this is required to ensure the polyfills are loaded before
// *native* html imports load on older Chrome versions. This *is* CSP
// compliant since CSP rules must have allowed this script to run.
// In all other cases, this can be async.
if (document.readyState === 'loading' && ('import' in document.createElement('link'))) {
document.write(newScript.outerHTML);
} else {
document.head.appendChild(newScript);
}
} else {
// Ensure `WebComponentsReady` is fired also when there are no polyfills loaded.
// however, we have to wait for the document to be in 'interactive' state,
// otherwise a rAF may fire before scripts in <body>
var fire = function() {
requestAnimationFrame(function() {
window.WebComponents.ready = true;
document.dispatchEvent(new CustomEvent('WebComponentsReady', {bubbles: true}));
});
};
if (document.readyState !== 'loading') {
fire();
} else {
document.addEventListener('readystatechange', function wait() {
fire();
document.removeEventListener('readystatechange', wait);
});
}
}
})();

5
package-lock.json generated
View File

@ -193,6 +193,11 @@
"hoek": "2.16.3"
}
},
"bootstrap": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.0.0.tgz",
"integrity": "sha512-gulJE5dGFo6Q61V/whS6VM4WIyrlydXfCgkE+Gxe5hjrJ8rXLLZlALq7zq2RPhOc45PSwQpJkrTnc2KgD6cvmA=="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",

View File

@ -11,5 +11,8 @@
"grunt-contrib-uglify": "~0.5.0",
"grunt-contrib-watch": "~0.6.1",
"grunt-sass": "^2.1.0"
},
"dependencies": {
"bootstrap": "^4.0.0"
}
}

View File

@ -8,19 +8,19 @@
<title>Happy Dev App</title>
<!-- Font -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Righteous">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!--<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Righteous">-->
<!--<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">-->
<!-- Stylesheets -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
<link rel="stylesheet" href="../css/hd-app.css" />
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="dist/css/hd-app.css" />
<!-- Javascript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/1.0.20/webcomponents-loader.js"></script>
<script type="text/javascript" src="dist/lib/webcomponents-loader.js"></script>
<link rel="import" href="https://cdn.happy-dev.fr/ldp-display/ldp-display.html" />
<link rel="import" href="https://cdn.happy-dev.fr/ldp-display/ldp-router.html" />
<link rel="import" href="https://cdn.happy-dev.fr/ldp-display/ldp-calendar.html" />
<link rel="import" href="dist/lib/ldp-display/ldp-display.html" />
<link rel="import" href="dist/lib/ldp-display/ldp-router.html" />
<link rel="import" href="dist/lib/ldp-display/ldp-calendar.html" />
</head>
<body>

View File

@ -12,7 +12,6 @@
<ldp-route name="drive">Drive</ldp-route>
<!-- <ldp-route name="home">Home</ldp-route> -->
</ldp-router>
<div id="menu-placeholder" ><img src="https://dummyimage.com/220x300/666666/cccccc&text=Placeholder/20" alt="placeholder"></div>
</div>
<main id="ldp-root" class="col-md-10">