erictgrubaugh
07/24/2019, 3:19 PMwsangster
07/24/2019, 3:42 PMerictgrubaugh
07/24/2019, 4:20 PM<!-- /SuiteScripts/my-project/main.html -->
<!DOCTYPE html>
<html>
<head>
<style>MP_STYLE</style> <!-- I have found link tags can be unreliable -->
</head>
<body>
<h1>My name is MP_NAME</h1>
</body>
</html>
/* /SuiteScripts/my-project/main.css */
h1 {
color: green;
font-weight: bold;
}
// /SuiteScripts/my-project/suitelet.js
define(["N/file"], function (f) {
function onRequest(context) {
var cssContents = f.load({id: "SuiteScripts/my-project/main.css"}).getContents();
var myName = "Eric";
var htmlContents = f.load({id: "SuiteScripts/my-project/main.html"}).getContents()
.replace(/MP_STYLE/, cssContents)
.replace(/MP_NAME/, myName);
context.response.write(htmlContents);
}
return { onRequest: onRequest };
});
erictgrubaugh
07/24/2019, 4:20 PMwsangster
07/24/2019, 4:22 PMwsangster
07/24/2019, 6:07 PMerictgrubaugh
07/24/2019, 6:15 PMerictgrubaugh
07/24/2019, 6:15 PMwsangster
07/24/2019, 6:22 PM