Add support for additonal js and css resources
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap.min.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
<link rel="stylesheet" href="../resources/layout.css" type="text/css">
|
||||||
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
<link rel="stylesheet" href="../resources/bootstrap/css/bootstrap-responsive.min.css" type="text/css">
|
||||||
|
{{{ resources }}}
|
||||||
{{{ css_resource }}}
|
{{{ css_resource }}}
|
||||||
<link rel="stylesheet" href="../resources/prism/prism.css" type="text/css">
|
<link rel="stylesheet" href="../resources/prism/prism.css" type="text/css">
|
||||||
<script src="../resources/zeroclipboard/ZeroClipboard.min.js"></script>
|
<script src="../resources/zeroclipboard/ZeroClipboard.min.js"></script>
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/{{ ol_version }}/ol.css" type="text/css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/{{ ol_version }}/ol.css" type="text/css">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/{{ ol_version }}/ol.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/{{ ol_version }}/ol.js"></script>
|
||||||
|
{{ resources }}
|
||||||
{{#if css_inline}}
|
{{#if css_inline}}
|
||||||
<style>
|
<style>
|
||||||
{{ css_inline }}
|
{{ css_inline }}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ var pjson = require('../package.json');
|
|||||||
|
|
||||||
var fileRegEx = /([^\/^\.]*)\.html$/;
|
var fileRegEx = /([^\/^\.]*)\.html$/;
|
||||||
var cleanupJSRegEx = /.*(goog\.require(.*);|.*renderer: exampleNS\..*,?)[\n]*/g;
|
var cleanupJSRegEx = /.*(goog\.require(.*);|.*renderer: exampleNS\..*,?)[\n]*/g;
|
||||||
|
var isCssRegEx = /\.css$/;
|
||||||
|
var isJsRegEx = /\.js$/;
|
||||||
|
|
||||||
function main(callback) {
|
function main(callback) {
|
||||||
|
|
||||||
@@ -37,6 +39,23 @@ function main(callback) {
|
|||||||
'.css">';
|
'.css">';
|
||||||
file.css_inline = fs.readFileSync(cssFile, 'utf-8');
|
file.css_inline = fs.readFileSync(cssFile, 'utf-8');
|
||||||
}
|
}
|
||||||
|
if (file.resources) {
|
||||||
|
var resources = file.resources.split(',');
|
||||||
|
var resource;
|
||||||
|
for (var i = resources.length - 1; i >= 0; --i) {
|
||||||
|
resource = resources[i];
|
||||||
|
if (isJsRegEx.test(resource)) {
|
||||||
|
resources[i] = '<script src="' + resource + '"></script>"';
|
||||||
|
} else if (isCssRegEx.test(resource)) {
|
||||||
|
resources[i] = '<link rel="stylesheet" href="' + resource +
|
||||||
|
'">"';
|
||||||
|
} else {
|
||||||
|
callback(new Error('Resource ' + resource +
|
||||||
|
' is no .js or .css'));
|
||||||
|
}
|
||||||
|
file.resources = resources.join('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user