Skip to content

Commit

Permalink
[hlx init] should create minimal example (Fixes #66) (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
tripodsan authored Aug 9, 2018
1 parent 7e58bff commit 9a85de8
Show file tree
Hide file tree
Showing 18 changed files with 172 additions and 166 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode/*
logs/*
layouts/complete/src/html.pre.js
layouts/default/src/html.pre.js
test/integration
test/tmp/*
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions layouts/complete/_gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.hlx/
.cache/
node_modules/
pipeline.log
logs
File renamed without changes.
Binary file added layouts/complete/helix_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions layouts/complete/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
![helix-logo](./helix_logo.png)

Helix - {{project.name}}
=======================

It works!
---------
File renamed without changes.
37 changes: 37 additions & 0 deletions layouts/complete/src/html.htl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html>
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="shortcut icon" type="image/x-icon" href="/dist/favicon.ico">
<title>${it.resource.title}</title>
<link rel="stylesheet" href="/dist/bootstrap.min.css"/>
</head>
<body>

<div data-sly-list="${it.resource.children}">
<div class="container-fluid">${item}</div>
</div>

<div class="container-fluid">
<em>generated at ${it.resource.time}</em>
</div>

</body>
</html>
30 changes: 30 additions & 0 deletions layouts/complete/src/html.pre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

// the most compact way to write a html.pre.js:
//
// module.exports.pre is a function (taking next as an argument)
// that returns a function (with payload, secrets, logger as arguments)
// that calls next (after modifying the payload a bit)
module.exports.pre = next => (payload, secrets, logger) => {
const mypayload = Object.assign({}, payload);

mypayload.resource.time = `${new Date()}`;

return next(mypayload, secrets, logger);
};
Binary file added layouts/complete/src/static/favicon.ico
Binary file not shown.
9 changes: 4 additions & 5 deletions layouts/default/src/html.htl
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="shortcut icon" type="image/x-icon" href="/dist/favicon.ico">
<title>${it.resource.title}</title>
<link rel="stylesheet" href="/dist/bootstrap.min.css"/>
<link rel="stylesheet" href="/dist/style.css"/>
</head>
<body>

<div data-sly-list="${it.resource.children}">
<div class="container-fluid">${item}</div>
<div class="container">${item}</div>
</div>

<div class="container-fluid">
<em>generated at ${it.resource.time}</em>
</div>
<hr>
<em>generated at ${it.resource.time}</em>

</body>
</html>
20 changes: 9 additions & 11 deletions layouts/default/src/html.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
*
*/

// the most compact way to write a html.pre.js:
//
// module.exports.pre is a function (taking next as an argument)
// that returns a function (with payload, secrets, logger as arguments)
// that calls next (after modifying the payload a bit)
module.exports.pre = next => (payload, secrets, logger) => {
const mypayload = Object.assign({}, payload);

mypayload.resource.time = `${new Date()}`;
/**
* The 'pre' function that is executed before the HTML is rendered
* @param payload The current payload of processing pipeline
* @param payload.resource The content resource
*/
function pre(payload) {
payload.resource.time = `${new Date()}`;
}

return next(mypayload, secrets, logger);
};
module.exports.pre = pre;
16 changes: 16 additions & 0 deletions layouts/default/src/static/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright 2018 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
body {
padding: 8px;
background-color: white;
font-family: Arial, sans-serif;
}
80 changes: 3 additions & 77 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@adobe/htlengine": "^1.0.2-SNAPSHOT.68",
"@adobe/hypermedia-pipeline": "^0.3.2-SNAPSHOT.74",
"@adobe/openwhisk-loggly-wrapper": "^0.2.0-SNAPSHOT.35",
"@adobe/parcel-plugin-htl": "0.4.1",
"@adobe/parcel-plugin-htl": "0.5.0",
"@adobe/petridish": "^1.0.5",
"archiver": "^2.1.1",
"bluebird": "^3.5.1",
Expand Down
Loading

0 comments on commit 9a85de8

Please sign in to comment.